Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230815

Render NativeStorage item on template

$
0
0

Hi! After a user logs in I save the user as “currentUser” in NativeStorage with no problem at all.

In another component “HomeComponent” I need to access that item and show some attribute in the template.

this.nativeStorage.getItem("currentUser").then(
      (user) => {
        console.log("currentUserrrrrr", user, 'JAPI', this);
        this.currentUser = user;
      },
      error => {
        console.log("CurrentUser", error);
      }
    );

This works fine, but when I do this in the template:

  <h1>Welcome {{currentUser.assesor.name}}</h1>

It seems to have broken the page and now I only see a white screen. I inspected it and I get this:

vendor.js:1377 ERROR TypeError: Cannot read property ‘asesor’ of null

I know that getItem is async. I’ve tried to use the " {{ expression | async }} " pipe but it also breaks.

It’s urgent. Please some one give me a clue. Thank you all in advance.


Viewing all articles
Browse latest Browse all 230815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>