小编Pra*_*nan的帖子

如何从angularjs中的json api获取固定数量的数据

见下面的代码:

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个数据应存储在名称中.

提前致谢

javascript json angularjs

2
推荐指数
1
解决办法
188
查看次数

标签 统计

angularjs ×1

javascript ×1

json ×1