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!!