Below is the HTML view in which user roles are checked. I want to bind a table of modified user roles using the actualizeRoles()
method. How can I achieve this?
<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 the user's roles model where the RoleIds[]
represents an array of role IDs.
export class UserRole {
UserId: number;
Name: string;
RoleName: string;
RoleIds: number[];
}