<script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
<div ng-app="Test" ng-controller="con">
<input type="text" ng-model="input" />
Hello {{input|B}}
<div ng-controller="BC">
<input type="text" ng-model="search.Name" />
<table>
<tr ng-repeat="item in Jsons|orderBy:'-id'|limitTo:2|filter:search">
<td>{{item.id}}</td>
<td>{{item.Name|lowercase}}</td>
</tr>
</table>
</div>
<superman></superman>
</div>
<script>
var ng = new angular.module("Test", []);
ng.factory("A", function () {
return "hehe";
});
ng.filter("B", function () {
return function (test)
{
return test + "1234";
}
})
ng.controller("con", function ($scope,A) {
$scope.input = A;
});
ng.factory("JS", function () {
var array = [{ id: 2, Name: 'B' }, { id: 3, Name: 'C' }, { id: 1, Name: 'A' }];
return array;
})
function BC($scope, JS) {
$scope.Jsons = JS;
}
ng.directive("superman", function () {
return {restrict:"E", template: "<p>my div2S</p>" };
})
</script>