$http({
method: 'GET',
url: '/api/getnewgroup'
})
.then(function (response) {
$scope.groups = response.data;
}, function (response) {
window.location.href = '/';
});
$http({
method: 'GET',
url: '/api/getnewgroupforprofsms'
})
.then(function (response) {
$scope.profsmsgroups.groups = response.data;
}, function (response) {
window.location.href = '/';
});我在$scope.groups和$scope.profsmsgroups.groups两个多范围内得到了两个不同的响应。
tr(ng-repeat='group in profsmsgroups.groups')
td
input(type = 'checkbox', ng-model='group.select')
td {{group.groupname}}
td {{group.contactsCount}}我的组名在$scope.profsmsgroups.groups作用域中,所以td {{group.groupname}}显示正确
但是我在$scope.groups有contactsCount
那么如何使用多ng-repeat响应呢?
我的$scope.profsms.groups json:
[
{
"id": 7,
"groupname": "Angular",
"createdAt": "2017-12-07T10:49:31.000Z",
"updatedAt": "2017-12-07T10:49:31.000Z",
"contactgroups": [
{
"id": 7,
"contact": {
"gsm": "4779306474"
}
}
]
},
{
"id": 3,
"groupname": "Vue",
"createdAt": "2017-12-05T09:36:15.000Z",
"updatedAt": "2017-12-05T09:36:15.000Z",
"contactgroups": []
},
{
"id": 5,
"groupname": "React",
"createdAt": "2017-12-05T09:36:29.000Z",
"updatedAt": "2017-12-07T10:46:28.000Z",
"contactgroups": []
},
{
"id": 6,
"groupname": "Node",
"createdAt": "2017-12-06T09:47:24.000Z",
"updatedAt": "2017-12-07T10:46:35.000Z",
"contactgroups": []
}
]我的$scope.groups响应
[
{
"id": 3,
"groupname": "Vue",
"contactsCount": 0,
"contactgroups": []
},
{
"id": 5,
"groupname": "React",
"contactsCount": 0,
"contactgroups": []
},
{
"id": 6,
"groupname": "Node",
"contactsCount": 0,
"contactgroups": []
},
{
"id": 7,
"groupname": "Angular",
"contactsCount": 1,
"contactgroups": [
{
"id": 7
}
]
}
]https://stackoverflow.com/questions/47692641
复制相似问题