从呼叫选择Angularjs控制器功能 [英] Call Controller Function from Select Angularjs
本文介绍了从呼叫选择Angularjs控制器功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道我怎么能叫我的控制器具体取决于在菜单中选择该选项的功能。
I was wondering how I can call a function in my controller depending on the option that is selected in a menu.
例如,使用NG-点击,当单击时,我可以调用该函数。我想要做的选择后,类似的事情在AngularJS。
For instance, using ng-click, when a is clicked, I can call the function. I want to do something similar upon selection in AngularJS.
<select class="dropdown">
<option value="">Menu</option>
<option ng-click="open()">Settings</option> // call open() when Settings is selected
</select>
任何想法?
推荐答案
与NG-模型中使用NG-变化:
Use ng-change with ng-model:
<select ng-model="model" ng-change="onSelect()" >
在哪里ONSELECT()是在你的范围的方法。
Where onSelect() is a method on your scope.
这篇关于从呼叫选择Angularjs控制器功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文