如何捕获typeahead:selected和typeahead:在angular.js中twitter typeahead的自动完成事件?

编程入门 行业动态 更新时间:2024-10-25 18:35:50
本文介绍了如何捕获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 参考: 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 : 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的自动完成事件?

本文发布于:2023-11-24 21:47:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626970.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自动完成   事件   selected   typeahead   angular

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!