ionic2 - Angular 2 /Ionic 2 undefined property causes template to not refresh -


i got done trying fix below issue 4 hours.

<ion-card *ngif="user">       <ion-item>         <h2>{{user.firstname}}!</h2>         <p>{{user.company.name}}</p>       </ion-item>  </ion-card>  <some-other-component></some-other-component>   user = {     firstname: 'nick' }; 

notice user.company not set. entire component stopped working. not ion-card, some-other-component rendered once , stopped updating. responding click events, never updating.

my question is: there way force angular / ionic display failed render versus failing?

my fix to: <p>{{user?.company?.name}}</p> it's scary me going have check every object property existence. i'm wondering if there need set/configure in order change how behaves. desired outcome either console error, or render angular 1.x did.

no, there no setting force rendering on runtime errors. have check assignment '?' or bind method checks internal assignments.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -