Using Angular cli v5 and angularfire2 v5, There is no error on console and terminal, all running fine but while calling google login function getting error on browser console.
Source code :
import { Component, OnInit, HostBinding } from '@angular/core';
import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase/app';
import { Router } from '@angular/router';
import { moveIn } from '../router.animations';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css'],
providers: [AngularFireAuth],
animations: [moveIn()],
host: {'[@moveIn]': ''}
})
export class LoginComponent implements OnInit {
error: any;
constructor(public afAuth: AngularFireAuth) { }
loginGoogle() {
this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
}
logout() {
this.afAuth.auth.signOut();
}
ngOnInit() { }
}
firebase.auth().signInWithPopup(new firebase.auth.GoogleAuthProvider())
– Uriiahfirebase.auth is not a function
. – Caryloncarynimport * as firebase from 'firebase/app';
. may be its not imported correctly – Uriiahnpm install angularfire2 firebase --save
, anything need to add in app.module ? – Caryloncaryn