の「削除」私は「@イオン/ストレージ」ストレージからランタイムエラーは、プロパティを読み取ることができません未定義
をインポート{ストレージ}を使用していますランタイムエラーにを与えるプロパティを読み取ることができません未定義使用時の「削除」this.storage.remove( 'key');
これは私が使用私の機能コードです:こと
import { Storage } from '@ionic/storage';
constructor(private storage: Storage) {
}
logout(): void {
this.storage.remove(this.HAS_LOGGED_IN);
this.storage.remove('email');
this.events.publish('user:logout');
};
注:this.storage.remove
logout(): void {
this.storage.remove(this.HAS_LOGGED_IN);
this.storage.remove('email');
this.events.publish('user:logout');
};
ストレージはどこに定義されていますか? – devqon
@ ionic/storageをapp.module.tsに追加しましたか? –
はいstorage.set()とstorage.get()はうまく動作します – moreshwar