I'm working on a Angular project where I need to give an use admin right. The isAdmin is a boolean (false/true). But it can't figure it how to parse the right value to the component and save the value.
<div class="checkbox">
<label>
<input type="checkbox" name="isAdmin" [(ngModel)]="user.isAdmin" [checked]="item.checked">
Is Admin?
</label>
</div>
The component.ts looks likes this:
this.userForm.get('isAdmin').valueChanges.subscribe(val => {
this.newUser.isAdmin = !!val;
});
Can someone see what is mine mistake?
Aucun commentaire:
Enregistrer un commentaire