Home
Run >
<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>