I have HTML view like below where user's roles are checked. I would like to bind table of changed user's roles using actualizeRoles()
method. How can I do that?
<md-accordion class="example-headers-align">
<md-expansion-panel hideToggle="true" *ngFor="let userRole of userRoles">
<md-expansion-panel-header>
<md-panel-title>
{{userRoles.UserName}}
</md-panel-title>
<md-panel-description>
{{userRoles.RoleName}}
</md-panel-description>
</md-expansion-panel-header>
<div *ngFor="let role of roles">
<div>
<input type="checkbox" [checked]="userRoles.RoleIds == role.Id">{{r.Name}}
</div>
</div>
<md-action-row>
<button md-button color="primary" (click)="actualizeRoles()>Approve</button>
</md-action-row>
</md-expansion-panel>
</md-accordion>
This is user's roles model below where RoleIds[]
has a table of Ids
roles.
export class UserRole {
UserId: number;
Name: string;
RoleName: string;
RoleIds: number[];
}