populate json content in table using angular6

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


populate json content in table using angular6



I have json to construct table by populating its header and body dynamically. But my following table angular6 code is not populating as expected. Could anyone suggest the problem is in json or table iteration.



Expected Output:



enter image description here



JSON:


this.columns = ["role1", "role2", "role3"];
this.permission =
[ {
role1: [{
master: { sub1: { read: true, write: true },
sub2: { read: true, write: true } },
support: { sub3: { read: true, write: false } },
admin: { sub4: { read: false, write: false } }
}],
role2: [{
master: { sub1: { read: true, write: false },
sub2: { read: true, write: false } },
support: { sub3: { read: true, write: true } },
admin: { sub4: { read: false, write: false } }
}],
role3: [{
master: { sub1: { read: true, write: true },
sub2: { read: true, write: true } },
admin: { sub4: { read: true, write: true } }
}]
},
{
role1: [{
master: { sub1: { read: true, write: true },
{ sub2: { read: true, write: true }
},
support: {
sub3: { read: true, write: false }
},
admin: {
sub4: { read: false, write: false }
}
}],
role2: [{
master: {
sub1: { read: true, write: false },
sub2: { read: true, write: false }
},
support: {
sub3: { read: true, write: true }
},
admin: {
sub4: { read: false, write: false }
}
}],
role3: [{
master: {
sub1: { read: true, write: true },
sub2: { read: true, write: true }
},
admin: {
sub4: { read: true, write: true }
}
}]
}
]



Output:
enter image description here





Can you provide the HTML?
– undefinedMayNotBeNull
25 mins ago




1 Answer
1



There are a bunch of errors in your json. You can use JSON lint to validate (although JSON will require you to put keys into double quotes whereas typescript doesnt)



Try again with this for permissions:


permissions


this.permission =
[ {
role1: [{
master: { sub1: { read: true, write: true },
sub2: { read: true, write: true } },
support: { sub3: { read: true, write: false } },
admin: { sub4: { read: false, write: false } }
}],
role2: [{
master: { sub1: { read: true, write: false },
sub2: { read: true, write: false } },
support: { sub3: { read: true, write: true } },
admin: { sub4: { read: false, write: false } }
}],
role3: [{
master: { sub1: { read: true, write: true },
sub2: { read: true, write: true } },
admin: { sub4: { read: true, write: true } }
}]
},
{
role1: [{
master: {
sub1: { read: true, write: true },
sub2: { read: true, write: true }
},
support: {
sub3: { read: true, write: false }
},
admin: {
sub4: { read: false, write: false }
}
}],
role2: [{
master: {
sub1: { read: true, write: false },
sub2: { read: true, write: false }
},
support: {
sub3: { read: true, write: true }
},
admin: {
sub4: { read: false, write: false }
}
}],
role3: [{
master: {
sub1: { read: true, write: true },
sub2: { read: true, write: true }
},
admin: {
sub4: { read: true, write: true }
}
}]
}
];






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

iDUlcW7ZGuuxhHVz8SlK s4Ievw0c4aWpoZdGouR2bz9l6plU,oyqt4PkVoDlW5K,2 vf,mZvAHpm 0lh,xsx DjLOdtOTwl9IUjfvbN,Tu 7
oYawSmc5YYisUqYnzInS2B KT 6,va3LBJ,8 XKGQYpFV,4H5hKFmXJf 4

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results