Filter as you type

Description

We can filter a list as you type.

Example


<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js">
</script><!-- w w  w  .j a v  a  2s  . co  m-->
</head>
<body>
    Name:<input type='text' ng-model='myFilterName'/>
    <div data-ng-init="names=[{name:'XML',city:'W3C'},{name:'Java',city:'Oracle'},{name:'Tutorial',city:'java2s.com'}]">
        <ul>
            <li data-ng-repeat="myObject in names |filter:myFilterName| orderBy:'name'">{{myObject.name}} - {{myObject.city}}</li>
        </ul>
    </div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities