下面我提到使用angularjs的datalist示例代码,
这里我的问题是我在输入文本框时,在controller add by added every words中,在datalist的需求中,选中的细节只显示在controller中,

<input list="browsers" name="browser" ng-model="SelectedDoctor" ng-change="LoadSessionData(SelectedDoctor)">
<datalist id="browsers" >
   <option data-ng-repeat="Doctor in DoctorsList" value="{{Doctor.Name}}"   id="doctorList"> </option>
</datalist>

控制器内
$scope.LoadSessionData(doctorName){ console.log(doctorName) }

最佳答案

一开始,这句话在语法上是错误的,

$scope.LoadSessionData(doctorName){ console.log(doctorName) }

应该改成,
$scope.LoadSessionData = function (doctorName){ console.log(doctorName) }

工作正常here

08-25 13:30