Importance of Promise Object in angular js

geetakokate's avatarSite Title

Hey guys, Writing this blog just to share an experience with you all. We have an input box which accepts keyword from user. We are sending api call to search that keyword, not when user enters full keyword, but when user enters a single character. And then it displays those keywords in drop-down.

We are using ngTagsInput plugin to add or select keyword. We send first api call when user enters first three characters and other calls are sent for each character entered by user. Due to this one issue occurs. Api responses are not received at same speed at which the user is entering the characters. So old response were displayed in the drop-down instead of new ones.

Ex. -> user entered ‘abcdef’, so, we have response for the api call which is given for ‘abcd’, but response for ‘abcde’ and ‘abcdef’ are pending. What we expect, is that…

View original post 388 more words

How To Use Image_tag In Rails With Mustache Template

Recently I have been working on one rails project, In which I have used Mustache.js.

Moustache is a logic-less template used for client-side dynamic template rendering.

You can check this link, Mustache, for more details.

As a rails developer, it’s common to use image_tag for displaying images in rails, so I preferred to use image_tag for displaying images.

So when I tried using image_tag with a mustache, I was surprised!! Why? Because that image_tag was not working as expected. So I thought something was wrong with image_tag. And then, I read more details about image_tag.

See below code…(In which image_tag was not working)

app/assets/javascripts/sample.coffee

app/views/sample.html.slim

After using the above code, I got compiled version of image_tag as below.Then I realized that image_tag is compiled at the server-side & then it sends compiled(html tag) to the client-side. But the mustache template is collected on the client-side. So the…

amoludage's avataramoludage

Recently I have been working on one rails project, In which I have used Mustache.js.

Mustache is a logic-less template which is used for client side dynamic template rendering.

You can check this link Mustache for more details.

As I’m rails developer it’s common to use image_tag for displaying images in rails, so I preferred to use image_tag for displaying images.

So when I was trying to use image_tag with mustache, I was surprised!! Why? Because, that image_tag was not working as expected. So I thought something is wrong with image_tag. And then I read more details about image_tag.

See below code…(In which image_tag was not working)

app/assets/javascripts/sample.coffee

app/views/sample.html.slim

After using above code I got compiled version of image_tag as below.

Then I realized that image_tag is compiled at server side & then it sends compiled(html tag) to the client side. But mustache template is compiled at client side. So the…

View original post 97 more words