Greetings! In my Nativescript Angular application, I am verifying at the beginning of the app whether the user is logged in or not and then calling a function based on that. Here's the code snippet:
ngOnInit() {
firebase.init({
onAuthStateChanged: function (data) {
if (data.loggedIn) {
this.navigateToHome();
}
},
})
Error Message:
The Firebase AuthStateListener failed to trigger the function (data) {
if (data.loggedIn) {
this.navigateToHome();
...<omitted>... } TypeError: Cannot read property 'navigateToHome' of undefined