I'm trying to 'get' an Array from the storage, save it to MaschinenArray and generate an ion-list. My only problem with this is, that I have to reload the page after the "ionic serve" command one time, else it says Maschinen = null as an example.
I thought it might be a problem if this function is async and the HTML will be loaded before, but if I trigger the Event later via a button it still says null.
I inititalize the Array above the constructor:
export class MaschinenParkPage {
maschinenArray : Maschine[] = [];
constructor(private menu: MenuController, public alertCtrl: AlertController, public navCtrl: NavController, private storage: Storage) {
this.storage.get('maschinen').then((buffer) => {
this.maschinenArray = buffer;
});
Any ideas? Or is the constructor maybe the wrong spot to initialize some variables?