-
Couldn't load subscription status.
- Fork 2.2k
AngularFireAuth's currentUser in ngOnInit #2733
-
On an older version, I could easily get the currentUser synchronously inside ngOnInit(). This is very useful when I need the currentUser.uid of the currently logged in user. However, after upgrading, currentUser now returns a promise instead, breaking my ngOnInit() and subcomponent. What's the best/easiest way to refactor my code to make this work again?
Beta Was this translation helpful? Give feedback.
All reactions
As far as I can tell, you can add async in front of your ngOnInit() function. Otherwise, you could do auth.currentUser.then(...)
Replies: 1 comment 1 reply
-
As far as I can tell, you can add async in front of your ngOnInit() function. Otherwise, you could do auth.currentUser.then(...)
Beta Was this translation helpful? Give feedback.
All reactions
-
Decided on this route as well. Forgot to update this post. So far I haven't had any problems with this implementation.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2