I have 2 API, 1 API is used to hit for getting menu list. Another API is used for fetching the data with Values after saving the checked list. So based on data i must uncheck the boxes with value as 0 and check if value is 1.
TS:
getUserMenu() {
let data = [{HasCaseManagement: 1,HasDicom: 0,HasEMR: 1,HasHomeDashboard: 1,HasReport: 1,HasSystemSettings: 1,HasUserManagement: 0,Id: 54,UserId: 1387}]
data.map(a => {
this.userMenu.map(r => {
if (r == a) {
r.isChecked = true;
this.selectedMenuIds.push(a)
this.selectedMenuIds = this.userMenu.filter(x => x.isChecked).map(y => y);
}
})
})
}
Here the data is the response which I got from API, for that particular user. So that I can bind the check value if it is 1, uncheck if it is 0.
How to bind the values from the response and make the checkboxes with those value as using angular2?