lundi 4 février 2019

On discard changes, checkbox still having same state

I am having a little problem that it's making headaches.

I have a modal where I show some info with checkboxes, the information, comes from an array, and I set the checkbox states from that array, and example of the array:

this.array = [
{scope: "acc", code: "1", alias: "aaa", selected: true, editable: true},
{scope: "acc", code: "2", alias: "bbb", selected: true, editable: true}
]

The thing that I want to do is to play as normal with the checks, but when i click a discardChanges button, the checkboxes, return the state that they were previously.

 <div *ngFor="let account of allAccountsList; let i = index;" class="">

          <div class="row">

              <input (click)="saveCheck(account.code, account.scope)" [(checked)]="account.selected"
                type="checkbox" name="genres" value="adventure" id="">
              <label for="" style="font-family: 'SExtralight'; font-size:14px;"></label>
            </div>
</div>

Thank you all.




Aucun commentaire:

Enregistrer un commentaire