Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am using twitter typeahead.js in my angular.js app. I am able to bind the datasource to the input="text" control, but my problem is i need to get the capture the typeahead:selected and typeahead:autocomplete events in angular.js.

The same in jQuery is much simpler, but similar to jQuery events how do i subscribe to selected and autcomplete events in angular.js?

I am using siyfion-angular-typeahead.js and typeahead.js and bootstrap.css

Reference : http://plnkr.co/edit/cMvm7Z4REuIP69Uk4Tzz?p=preview[^]

The HTML looks like this

<input type="text" ng-model="model.property" sf-typeahead options="exampleOptions" datasets="numbersDataset" class="form-control input-large" placeholder="Auto Fill" style="width: 395px;" tabindex="1" />*

I am trying to use the $scope.$on("typeahead:selected") event subscription for the $scope.$emit("typeahead:selected") in angular-typeahead.js but this fires for any control in the scope.

Also the problem is i have a list of autocompleters so i need to determine for which control it is firing the event!

I also tried to create angular directives but that did not help!
All my research and R&D seems to be misleading me to something else!

Could anyone tell me the right way of getting the selected and autocomplete events twitter typeahead.js?

Thanks in advance!!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900