Hello, we tried to add a RxJS pipe in our Angular Resolver: the resolver
process starts but doesn't end, so we can't show the result in our html
component.
Otherwhise, everything works correctly if we move the pipe on the ngOnInit
method of the main component.
What are we doing wrong?
Example with myResolver.ts (*Resolve doesn’t end his process*):
resolve(): Observable<any> | Promise<any> | any {
let T = mergeMap((user: firebase.User) => {return
Observable.fromPromise(user.getIdToken()) });
let D = mergeMap((token: string) => { return
this.http.get('https://myfakedomain.com/user?access_token=' + token) });
let P = this.afAuth.authState // return Observable<User>
.pipe(
T, D
)
return P;
}
Example with ngOnInit on mainComponent.ts (*it works!*):
ngOnInit() {
let T = mergeMap((user: firebase.User) => { return
Observable.fromPromise(user.getIdToken()) });
let D = mergeMap((token: string) => {return this.http.get('
https://myfakedomain.com/user?access_token=' + token) });
let P = this.afAuth.authState // return Observable<User>
.pipe(
T, D
).subscribe(data => this.myData = data);
}
Thank You
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.