标签:meta ctrl script 选择 输入 doc put 数组 doctype
输入过滤器可以通过一个管道字符(|)和一个过滤器添加到指令中,该过滤器后跟一个冒号和一个模型名称。
filter 过滤器从数组中选择一个子集:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p>输入过滤器</p>
<p><input type="text" ng-model="test"></p>
<ul>
<li ng-repeat="x in names|filter:test|orderBy:'country'">
{{(x.name|uppercase)+','+x.country}}
</li>
</ul>
</div>
<script>
var app=angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.names=[
{name:'star',country:'china'},
{name:'star1',country:'us'},
{name:'star2',country:'un'}
]
})
</script>
</body>
</html>
标签:meta ctrl script 选择 输入 doc put 数组 doctype
原文地址:https://www.cnblogs.com/lxystar/p/10840166.html