var app = angular.module("mymodule",[]);
app.controller("employeeController",function($scope,$http){
var url ="data/records.json";
$http.get(url).success(function(response){
$scope.employees =response;
});
});
最佳答案
您应该访问response.data
,同时将 success 替换为 then,.success
已被弃用。
$http.get(url).then(function(response){
$scope.employees =response.data;
});
关于angularjs - 为什么在这段代码中使用 $http.get 时不使用 Angular js ajax ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43051175/