我有一个指令,我使用的是angular ui typeahead。myModel有双向绑定。我将更新控制器中的myModel值,并希望在myModel值发生更改时触发typeahead-on-select。
<input type="text" ng-model="myModel" placeholder="Locations loaded via $http" uib-typeahead="address for address in getLocation($viewValue)" typeahead-loading="loadingLocations" typeahead-no-results="noResults" class="form-control" typeahead-on-select="myFunc()">
因此,当myModel值更新时,我需要运行myFunc()。有办法做到这一点吗?
发布于 2017-01-16 21:04:12
您可以在输入中使用ng-change="myFunc()“指令。
只要您的myModel值发生更改,它就会运行myFunc
https://stackoverflow.com/questions/41676595
复制相似问题