Ionic storage undefined

I have this code:

<ion-col col-4>
  <h1> {{ }} </h1>
<ion-col col-6>
  {{ employee.avatar_urls[96] }}

and this code:

constructor(...) {"userLogged").then(res => {
      this.employee = res

In the console.log() the employee appear with all the fields, when the DOM try to loading the page it return “cannot read property name of undefined”… I can’t understand, if in .log() it appears, why not in the DOM?

promises are asynchronous. view loaded before data is fetched. use ? in the html. {{ employee?.name }}.

It works!! What change the “?” ???

safe navigation operator

1 Like