bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Question: Typeahead on callback

Open Marcohj opened this issue 13 years ago • 5 comments

Im having a really hard time figuring out what is going wrong here... http://plnkr.co/edit/poEM9J?p=preview

What im trying to do is call the Yahoo Service, and when the callback comes, insert into the typeahead dropdown.

But it dosen't seems like it's happy with the delayed response, any ideas?

Marcohj avatar Mar 20 '13 08:03 Marcohj

Try this: http://plnkr.co/edit/awR7gV?p=preview

rgaskill avatar Mar 20 '13 15:03 rgaskill

Your sir are brilliant!

Guess i should go about $Q and $defer.. :)

Marcohj avatar Mar 20 '13 15:03 Marcohj

@rgaskill Thnx for helping out on this one!

@Marcohj this was tricky as it looks like this Yahoo service is really picky about callback names. With another service, we could use standard JSONP request with AngularJS and the whole code becomes way simpler.

For example, here is the plunker showing autocomplete for all the cities in US: http://plnkr.co/edit/eGG9Kj?p=preview

pkozlowski-opensource avatar Mar 20 '13 18:03 pkozlowski-opensource

@pkozlowski-opensource it seems that in your plunker typeahead cannot correctly load its template from $templateCache; is this a known issue?

redaemn avatar Mar 20 '13 20:03 redaemn

@redaemn, sorry, I guss I've created 10 000 plunks and linked the wrong one :-) Check this: http://plnkr.co/edit/eGG9Kj?p=preview

pkozlowski-opensource avatar Mar 20 '13 21:03 pkozlowski-opensource