简体   繁体   中英

how to use datalist in angularJs

Below i mention datalist sample code using angularjs, here my problem is what ever i am typing the text box, in controller add by added every words,in my requirement in datalist selected details only shows in 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>

In Controller

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

At the outset, This line seems wrong syntactically,

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

should change to,

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

Works fine here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM