<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module('myApp',[]);
app.controller("myControl",function($scope){
$scope.friends = [
{name:'aaa',phone:'110'},
{name:'bbb',phone:'119'},
{name:'bbb',phone:'119'},
{name:'ccc',phone:'120'},
{name:'ddd',phone:'120'},
{name:'eee',phone:'114'},
{name:'fff',phone:'911'},
{name:'ggg',phone:'10010'},
{name:'hhh',phone:'10086'}
]
});
</script>
</head>
<body ng-app="myApp" ng-controller="myControl">
<label>Search:<input ng-model="searchText"></label>
<table id="searchTextResult">
<tr><th>name</th><th>phone</th></tr>
<tr ng-repeat="friend in friends | filter:searchText"> <!-- 向表达式添加过滤器:可以通过一个管道字符(|)和一个过滤器添加到表达式中-->
<!-- filter:searchText 模糊查询 -->
<td>{{friend.name}}</td>
<td>{{friend.phone}}</td>
</tr>
</table>
</body>
</html>