How to return Observable after some Promise get resolved in Ionic 2/Angular 2?

后端 未结 4 1355
独厮守ぢ
独厮守ぢ 2020-12-08 16:06

I am trying to return an observable after a successful completion of my Promise, but that function is not returning Observable. To be specific to code, i want to fetch auth

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 16:36

    You would be returning a Promise (if you hadn't missed the return part in front of it) which would return an Observable on success. Consider using Observables only, rather than mixing them both.

    You can also encapsulate it into a new Observable: new Observable(observer =>
    https://angular-2-training-book.rangle.io/handout/observables/using_observables.html

提交回复
热议问题