angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Auth toPromise() didn't work.

Open paulogr opened this issue 10 years ago • 2 comments

When I subscribe for authentication it works pretty well:

this.authService.af.auth.subscribe(auth => { console.log(auth); // works as expected });

bu if I use toPromise(), the callback is never called;

this.authService.af.auth.toPromise().then(auth => { console.log(auth); // this line is never called; });

What am I doing wrong?

Thanks!

paulogr avatar Aug 18 '16 19:08 paulogr

It looks like that the method has not been (yet) implemented in this object. If you want to perform a action just once you might try to unsubscribe in the first response:

    this.af.auth.subscribe( authData =>{

       //do stuff

        this.af.auth.unsubscribe();

    });

lfarroco avatar Aug 19 '16 01:08 lfarroco

That said, I'm gonna close this issue.

Thank you.

paulogr avatar Aug 20 '16 03:08 paulogr