Property 'subscribe' does not exist on type Auth

吃可爱长大的小学妹 提交于 2019-12-04 17:26:28

It seems that the subscribe function doesn't exist, you should try using this instead:

this.afAuth.auth.onAuthStateChanged((user) => {
    if (user != null) {
        // User is logged in, use the user object for its info.
        this.loggedIn = true;
        this.user_displayName = user.displayName;
        // etc.
    } else {
        // User is not logged in, redirect to where you need to.
    }
});

This is the code I use for my Angularfire2 apps. If it still doesn't work, please tell me :)

Another option is to subscribe to authState and keep your original code essentially the same.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!