运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body> <div ng-app="myApp" ng-controller="sizeCtrl"> <ul> <li ng-repeat="x in cars | limitTo : 3 : 1">{{x}}</li> </ul> </div> <script> var app = angular.module('myApp', []); app.controller('sizeCtrl', function($scope) { $scope.cars = ["Audi", "BMW", "Dodge", "Fiat", "Ford", "Volvo"]; }); </script> <p>Only three items of the array are displayed, starting from position 1 (which is the second item of the array).</p> </body> </html>