Checkbox shows error in console when changing Checked state

Asked

Viewed 76 times

0

I’m doing a checkbox search to do when it’s fake and when it’s true to change the status cheked and is making the following mistake:

Error: Expressionchangedafterithasbeencheckederror: Expression has changed after it was checked. Previous value: 'ngIf: true'. Current value: 'ngIf: false'.

The code works but if you are giving this error I believe it can be improved and no longer display this error:

     <div class="form-group ml-1">
        <input id="filterImg" type="checkbox" class="check-filter-media" [checked]="gifCheck.checked === false" #imgCheck>
        <label for="filterImg" class="btn btn-filter-media">Imagem</label>
     </div>
     <div class="form-group ml-1">
         <input id="filterGif" type="checkbox" class="check-filter-media" [checked]="imgCheck.checked === false" #gifCheck>
         <label for="filterGif " class="btn btn-filter-media">GIF</label>
     </div>
   <app-component-1 *ngIf="imgCheck.checked === true"></app-component-1>
   <app-component-2 *ngIf="gifCheck.checked  === true "></app-component-2>
  • https://stackoverflow.com/questions/43513421/ngif-expression-has-changed-after-it-was-checked

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.