简单教程
提交运行
代码编辑器:
<!DOCTYPE html> <meta charset="utf-8"> <link href="/static/next/css/tryit.css?v=2017082407" rel="stylesheet"/> <script src="http://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script> <div ng-app="myApp" ng-controller="namesCtrl"> <p><input type="text" ng-model="test"></p> <ul> <li ng-repeat="x in names | filter:test | orderBy:'province'"> {{ (x.name | uppercase) + ', ' + x.province }} </li></ul> </div> <footer>简单教程,简单编程<br/>Copyright © 简单教程 www.twle.cn</footer> <script> angular.module('myApp', []).controller('namesCtrl', function($scope) { $scope.names = [ {name:'永定土楼',province:'福建'}, {name:'都江堰',province:'四川'}, {name:'凤凰古城',province:'湖南'} ]; }); </script>
运行结果: