我正在使用带有存储功能的 ionic 2。如果我将存储代码保留在函数之外,它就不起作用。请告诉我。
constructor(public navCtrl: NavController,
public settings: Settings,
public formBuilder: FormBuilder,
public navParams: NavParams,
public translate: TranslateService,
private storage : Storage) {
}
this.settings.load().then(() => {
this.settingsReady = true;
this.options = this.settings.allSettings;
this._buildForm();
});
this.storage.set('nam','par');
}