见下面的代码:
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://www.w3schools.com/angular/customers.php")
.then(function (response) {
$scope.names = response.data.records;
});
});
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,我们编写了用于获取记录中的所有数据的代码存储在名称中,但要求是前5个数据应存储在名称中.
提前致谢