【发布时间】:2017-06-10 10:04:56
【问题描述】:
我有一个使用 $resource.get 请求返回 JSON 对象的工厂,但我无法从我的 ngresource 工厂获取一些数据:
HTML
<body ng-app="myApp" ng-controller="myCtrl" >
<table border="1">
<tr>
<th>Name</th>
<th>city</th>
</tr>
<tr ng-repeat="x in data.records">
<td style="padding: 20px">{{records.Name}}</td>
<td style="padding: 20px">{{records.City}}</td>
</tr>
</table>
</body>
JS:
angular.module('myApp',['ngResource']);
angular.module('myApp').controller("myCtrl",function (yourService,$scope) {
});
angular.module('myApp').
factory('yourService', ["$resource", function($resource,$scope){
return $resource("http://www.w3schools.com/angular/customers.php").get().$promise
.then (function (data){
});
return data;
}]);
【问题讨论】:
标签: angularjs