mardi 7 novembre 2017

Angular (4.x.x) Material CheckBox Component (mat-checkbox) : [checked] not working

How this is possible????

See this:

<div class="col-lg-1 check-field">
    <mat-checkbox color="primary"
                  [checked]="true"
                  formControlName="flagRimb">Rimb.
    </mat-checkbox>
</div>

I've put the true value on checked and still not seeing the mat-checkbox checked when component is loaded!! incredible!!!

The only thing that can disturb the behavior is the formControl, there is it:

     return this._formBuilder.group({
        [...],
        flagAdd : ['',Validators.required],
        [...]
    });

The formControlName is there because I need to set checkbox value relative to a model.value given by http rest call, but even with a default value set to true that's not working !!

It seems from the console that the exploded material html that generate the don't inherit checked property from <_<.

Any idea? Thanks in advance!!




Aucun commentaire:

Enregistrer un commentaire