如何迭代RoleIds
数组以检查条件并选中用户角色的ID与role
数组中的角色ID相同的复选框?
<md-accordion class="example-headers-align">
<md-expansion-panel hideToggle="true" *ngFor="let u of userRole">
<md-expansion-panel-header>
<md-panel-title>
{{u.UserName}}
</md-panel-title>
</md-expansion-panel-header>
<div *ngFor="let r of role; let i = index">
<div>
<input type="checkbox" [checked]="(u.RoleIds[i] == r.Id) ? true : false">{{r.Name}}
</div>
</div>
<md-action-row>
<button md-button color="primary" (click)="saveChanges()">Approve</button>
</md-action-row>
</md-expansion-panel>
</md-accordion>