This AngularJS limitto filter is used to extract subset of array with specified number of items, beginning from some index in the array. The limitTo filter also works on strings.
Syntax
{{ "Tech Strikers" | limitTo:4 }} {{ [1,2,3,4,5,6,7,8,9] | limitTo:1 }}
<html> <head> <title>My first AngularJS limitto filter code</title> <Script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"> </Script> <Script> function setLimit($scope) { $scope.myArray = [1,2,3,4,5,6,7,8,9]; $scope.arrayLimit = 6; $scope.myWebSite = "Tech Strikers"; $scope.myWebSiteLimit = 4; } </Script> </head> <body> <div ng-app=""> <div ng-controller="setLimit"> Array Limit {{myArray}} to : <input type="integer" ng-model="arrayLimit"> <p>Array Output : {{ myArray | limitTo:arrayLimit }}</p> String Limit {{myWebSite}} to : <input type="text" ng-model="myWebSiteLimit"> <p>String Output : {{ myWebSite | limitTo:myWebSiteLimit }}</p> </div> </div> </body> </html>See Live Example