我有一个从 api 返回的 json 对象,这是一个示例。
{
"availablePermissions": [
{
"id": 25,
"name": "Dashboard Access",
"systemName": "DashboardAccess"
}, {
"id": 32,
"name": "Claims Access",
"systemName": "ClaimsAccess"
}, {
"id": 34,
"name": "Purchasing Reports Access",
"systemName": "PurchasingReportsAccess"
}
],
"availableApplicationRoles": [
{
"id": "6a8d97b8-7fd5-485c-8eff-5869232b7f26",
"roleName": "Billing",
"systemName": null
}, {
"id": "fbb6c213-2b19-4eec-891f-0552e3b14b5b",
"roleName": "Power User",
"systemName": null
}
],
"allowed": {
"dashboardAccess": {
"144ca9cc-9d56-4cd0-b9b2-c097d606d36e": false,
"fbb6c213-2b19-4eec-891f-0552e3b14b5b": true
},
"claimsAccess": {
"144ca9cc-9d56-4cd0-b9b2-c097d606d36e": false,
"fbb6c213-2b19-4eec-891f-0552e3b14b5b": true
},
"purchasingReportsAccess": {
"144ca9cc-9d56-4cd0-b9b2-c097d606d36e": false,
"fbb6c213-2b19-4eec-891f-0552e3b14b5b": true
}
},
"pager": {
"pageIndex": 0,
"pageSize": 10,
"totalCount": 3,
"totalPages": 1,
"hasPreviousPage": false,
"hasNextPage": false
},
"success": true,
"message": null
}
现在在 ngOnInit 内的组件中,我有代码将其绑定到名为 acl 的属性,这是代码。
var dummyPermission = {
id: "0",
roleName:"Permission",
systemName:null
}
var self = this;
this.aclData.loadACL(dataTablesParameters, pageInfo)
.subscribe(data => {
if (data.success) {
self.pluginService.lengthMenuAngularDataTable("#ACLTable", dataTablesParameters.length);
self.acl = data;
self.acl.availableApplicationRoles.unshift(dummyPermission);
callback({
recordsTotal: self.acl.pager.totalCount,
recordsFiltered: self.acl.pager.totalCount,
data: []
});
console.log("success load acl table");
self.pluginService.witzThemeLoader(false);
self.pluginService.datePicker();
}
暮色呼如
慕桂英3389331
慕慕森
相关分类