【发布时间】:2015-09-21 20:00:16
【问题描述】:
我在我的视图中有这个,以便人们去示例,查看/1 我通过 restful 获取该用户的所有数据,我用表格在 html 中解析它,我使用 cakephp,我不想用 angularJS,有一个 JQuery 库可以做这个工作,你知道名字吗?
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("/social/users.json")
.success(function (response) {$scope.users = response.users;});
});
</script>
然后我收到这个答案
{
"user": [
{
"id": 1,
"email": "email",
"name": "name",
"last_name": "last",
"username": "itsme",
"password":"password",
"created": "2015-09-21T16:44:47+0000",
"modified": "2015-09-21T16:52:08+0000"
}
]
}
如何解析重复此代码并在 html 中填充数据?
<div ng-app="myApp" ng-controller="customersCtrl">
<table>
<tr ng-repeat="x in users">
<td>{{ x.name }}</td>
<td>{{ x.last_name }}</td>
</tr>
</table>
</div>
【问题讨论】:
标签: php json restful-architecture