I’m reading some data from Storage and after its done I want to display to the user. When I do a console.log I can see the object but when I try to display on the html I cannot see it. Here is the code.
import { Component,ViewChild } from '@angular/core';
import { NavController,Nav } from 'ionic-angular';
import { Setup } from '../frameSetup/setup';
import { Storage } from '@ionic/storage';
@Component({
templateUrl: 'page1.html'
})
export class Home {
deviceObj = [];
setupPage = Setup;
constructor(public navCtrl: NavController, private storage: Storage) {
//this.storage.remove('deviceInfo');
this.getData();
}
getData(){
this.storage.get('deviceInfo').then((resp) => {
if(resp !== null){
console.log(resp);
this.deviceObj.push(resp);
}
});
}
}
On my html I have the following.
<ion-header>
<ion-navbar>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Home</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<p *ngFor="let x of deviceObj">
{{x.frameName}}
</p>
</ion-content>
If I do not read the data from the storage and just hardcode the array of object it works fine, but I want to get data from the Storage and display.
Thanks for the help
-Ennio

