Greetings! I am currently delving into ionic 3
and have some data stored in local storage. My aim is to utilize this data within a component. However, it seems that ionViewDidLoad
, which functions perfectly on a regular page, is not working on a component. Below is the error message I encountered:
https://i.sstatic.net/WFAtU.png
Is there any alternative approach that you could recommend?
Component code snippet (offre.ts):
import { Component, Input , Output } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable } from "angularfire2/database";
import { IonicPage, NavController, NavParams} from 'ionic-angular';
import { NativeStorage } from '@ionic-native/native-storage';
@Component({
selector: 'offre',
templateUrl: 'offre.html',
})
export class OffreComponent {
@Input('var') var;
text: string;
datas: FirebaseListObservable<any>;
user : any ;
constructor(public navCtrl: NavController, public db: AngularFireDatabase, public nativeStorage: NativeStorage) {
this.datas=db.list('/posts');
}
ngAfterViewInit(){
console.log(this.var);
}
}