Reading data from storage and display

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';

  templateUrl: 'page1.html'
export class Home {
  deviceObj = [];
  setupPage = Setup;

  constructor(public navCtrl: NavController, private storage: Storage) {

  getData(){'deviceInfo').then((resp) => {
      if(resp !== null){

On my html I have the following.

    <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>

<ion-content padding>
  <p *ngFor="let x of deviceObj">

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

1 Like

Hello Ennio,

have you tried this.deviceObj = resp; instead of this.deviceObj.push(resp)?

try this:

  let that = this;'deviceInfo').then((resp) => {
      if(resp !== null){

ahh, that did. Sorry I guess working late on this does not help :slight_smile:

We know how that is… :grin:

I am a beginner to ionic so can you tell me what is frameName in {{x.frameName}}.