AngularJS LimitTo过滤器
html代码:
<body ng-app="AngularfilterApp">
<div ng-controller="filterctrl">
Default Array : {{samarry}}<br /><br />
LimitTo Get Elements from Beginning:{{samarry | limitTo : 3}}<br /><br />
LimitTo Get Elements from Ending:{{samarry | limitTo : -3}}<br /><br />
Get Elements from String : {{samstr | limitTo : 4}}
</div>
</body>
JavaScript代码:
<script>
var app = angular.module("AngularfilterApp", []);
app.controller("filterctrl", function ($scope) {
$scope.samarry = [20, 10, 43, 5, 1, 4, 6]
$scope.samstr = "tutlane.com";
});
</script>