I'm just getting into angular2 so not sure how I would subscribe to the onAuth event using angularFire2. I see documentation on how to subscribe to the auth state in the template but maybe you can also add a javascript example that lets you subscribe to login and logout events? I'm not sure how to use the ReplaySubject class.
The auth property also works as an observable, so you can subscribe to changes:
constructor(af: AngularFire) {
af.auth.subscribe(auth => {
if(auth) {
console.log('logged in');
} else {
console.log('not logged in');
}
});
}
There will be a big docs update in the near future so stay tuned :boom:
awesome... also is there a way I can find out if the current session or user is authenticated from the controller without a subscription?
When will be this big documentation update? It still has no good docs, I think.
It's a pity, though.
Most helpful comment
When will be this big documentation update? It still has no good docs, I think.
It's a pity, though.