javascript - Suggestion in text box possible? -
i have input box type text:
<input type="text></input> i have list of names:
$scope.employees = [{ name: "vishnu" }, { name: "seenu" }]; now let 2. when type v, should show vishnu suggestion. when type se, should showseenu` suggestion. how can achieved?
populate options of datalist values in $scope.employees data-ng-repeat:
var app = angular.module('myapp', []); app.controller('mycontroller', function($scope, $http) { $scope.employees = [{ name: "vishnu" }, { name: "seenu" }]; }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <div ng-app="myapp" ng-controller="mycontroller"> <input type="text" list="names" placeholder="pick name.."> <datalist id="names"> <option data-ng-repeat="item in employees" value="{{item.name}}"> </datalist> </div> good luck!
Comments
Post a Comment