Very Important !!
use subscribe
constructor(public af: AngularFire) {
af.auth.subscribe((authstate) => {
console.log(authstate);
authstate == null ? logout() : login(authstate.auth.displayName);
});
}
And Think change to Callback mode .............
==========
First :
everyone use af.auth.getauth() , then check, have value is login, null is not login.
But it's mistack. Reload page, Change page AngularFire miss...... af.auth be free.
Only login page can get af.auth
Second:
af.auth.subscribe ( ....... ) When auth check finish, run subscribe ( ..... )
This is real get auth. But Think login different First way........