This is my current code:
<select name="role" [(ngModel)]="user.role">
<option *ngFor="let role of roles" [ngValue]="role" [attr.selected]="role == user.role ? 'true' : 'false'">{{role.name}}</option>
</select>
I'm loading all the roles in an array, and the user class has a Role attribute (which is not loaded like user.role = roles[0]
but just through the backend data).
The problem is that the selected attribute is not working, and my select is not going to the correct role. What am I doing wrong?