I have a userData$
observable which basically connects to firebase. On this user object, is a bunch of optional properties.
I am using Ionic2 and I create the observable during ionViewDidLoad
which is described here
This code
<h1 *ngIf="(userData$ | async)?.name">{{(userData$ | async)?.name}}</h1>
Causes me to have the following error
FIREBASE WARNING: Exception was thrown by user callback. Error: Expression has changed after it was checked. Previous value: 'CD_INIT_VALUE'. Current value: ''. It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook ?
And in particular the first line on the stack trace is ExpressionChangedAfterItHasBeenCheckedError
What am I doing wrong here with that async template? If I delete *ngIf
it works. If I change ...">Hello World"</h1>
it works. But I can't do both here and not really sure why. I think that that ngif runs but the interpolation is missed.
Does anyone know why this happens or what the correct method should be?
Thanks!