How to keep the checkbox checked by default


#1

Here is my code:

I want to keep my checkbox checked when I load and reload the page and get the value.

HTML

<ion-item style="background-color: rgba(0,0,0,0); width:100%" > 
     <ion-label> Add (10%) </ion-label> 
      <ion-checkbox item-right class="checkbox-right" #checkbox 
      (ionChange)="addService(checkbox.checked)"></ion-checkbox>
</ion-item> 

FILE.ts

addService(service : boolean) { if(servico === true) { this._service = this._total * 10 / 100 } else { this._service = 0; } }