lundi 11 novembre 2019

Saving checkbox selected when page is reloaded or visited later in Angular

I have a checkbox in my component:

<input (change)="fieldChange($event)" type="checkbox" />

I want it to still be checked/unchecked once you visit this component later or reload the page. So it basically needs to be saved, I guess? Very new to Angular and searched for 2 hours but found nothing working.

This is the typescript I have so far:

  public fieldChange(values: any){
    if (values.currentTarget.checked){
      console.log('hi');
    }
  }

And I see that this is working, but it also needs to be unchecked and saved. Can someone please help me?




Aucun commentaire:

Enregistrer un commentaire