在我的代码中,他们是一个下拉列表,如果你在该输入字段中写一些内容,它会显示数据列表,如果该单词可用....
我的问题是,当我从列表中选择项目而不是在输入字段中输入某些内容时,我想运行更改功能.... 但是当我在输入字段中输入某些内容时,我仍然需要数据表...
http://jsfiddle.net/4dGxn/148/
HTML
<div class="form-group" ng-controller="mainCtrl">
<input type="text" class="form-control" name="srch" list="datalist1" id="exampleInputName2 srch" placeholder="author" ng-model="author_name" ng-change="changeFun()">
<datalist id="datalist1">
<option ng-repeat="author in authors" value="{{author}}">
</datalist>
</div>
角
var app = angular.module("app", []);
app.controller("mainCtrl", ['$scope', function($scope){
$scope.authors = ["author1", "author2", "author3", "author4", "author5"];
$scope.changeFun = function(){
console.log("hello i am change function")
}
}]);