如何捕获typeahead:selected和typeahead:在angular.js中twitter typeahead的自动完成事件? [英] How to capture the typeahead:selected and typeahead:autocomplete events of twitter typeahead in angular.js?

查看:143
本文介绍了如何捕获typeahead:selected和typeahead:在angular.js中twitter typeahead的自动完成事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在我的angular.js应用中使用twitter typeahead.js。我能够将数据源绑定到input =text控件,但我的问题是我需要捕获typeahead:selected和typeahead:angular.js中的autocomplete事件。



jQuery中的相同内容要简单得多,但与jQuery事件类似,我如何订阅angular.js中的选定事件和自动完成事件?



我我正在使用siyfion-angular-typeahead.js和typeahead.js以及bootstrap.css



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



HTML看起来像这样



< input type =textng-model =model.propertysf-typeahead options =exampleOptionsdatasets =numbersDatasetclass =form-control input-largeplaceholder =Auto Fillstyle =宽度:395像素; tabindex =1/> *



我正在尝试为$ scope使用$ scope。$ on(typeahead:selected)事件订阅。在angular-typeahead.js中$ emit(typeahead:selected)但是这会触发范围内的任何控件。



另外问题是我有一个列表autocompleters所以我需要确定它触发了哪个控件!



我也尝试创建角度指令,但这没有帮助!

我所有的研究和R& D似乎都误导了我的其他东西!



有谁能告诉我正确的方法获得所选和自动完成的活动twitter typeahead .js?



提前致谢!!

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

推荐答案

范围。


on(typeahead:selected)事件订阅
on("typeahead:selected") event subscription for the


范围。


这篇关于如何捕获typeahead:selected和typeahead:在angular.js中twitter typeahead的自动完成事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆