我有一个angularjs代码和html
<input type="text" ng-model="selected" uib-typeahead="demos for demos in demo | filter:$viewValue | limitTo:8">
$scope.demo = ['demo-NV-enable','demo-NV-disable','demo-NV-shutdown','demo-NV-open'];
在用户选择的输入(如'demo-NV-enable')之后,必须将其更改为'demo / Nv / open'以在angularjs中执行某些操作。
答案 0 :(得分:0)
您可以在视图中使用typehead-on-select:
<input
type="text"
ng-model="selected"
uib-typeahead="demos for demos in demo | filter:$viewValue | limitTo:8"
typeahead-on-select="myFunction($item, $model, $label, $event)"
>
在您的控制器中:
$scope.myFunction( $item, $model, $label,$event ) {
//do stuff here
}