Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

I'm stuck in ionic Storage. Need help

$
0
0

@cybentizens wrote:

Hi

Let me explain to you. What I’ve done and what is remaining.

Done:
Checkbox value is saved in storage and it is successfully working.

Remaining:
On clicking checkbox, I’m adding a class to content but I don’t know how to save the class to storage.

Popover.html

 <ion-item>
    <ion-label>English</ion-label>
    <ion-checkbox (click)="activateEnglish()" [checked]="EnglishCheckbox"></ion-checkbox>
  </ion-item>

Popover.ts

constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private storage: Storage) {
    storage.get('EnglishLang').then(EnglishLang=> this.EnglishCheckbox = EnglishLang);
  }

EnglishCheckbox: boolean = false;

  //Active English Function
  activateEnglish(){
    this.textEle.classList.toggle('showEnglish');
    this.storage.set('name', 'test').then(() => {
      if (this.EnglishCheckbox){
        this.EnglishCheckbox = false;
        this.storage.set('EnglishLang', 'false');
      } else {
        this.EnglishCheckbox = true;
        this.storage.set('EnglishLang', 'true');
      }
    });
  }

On click checkbox I’m adding showEnglish class to my content but it is not saving it to storage. How to do it.

Best Regards

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>