当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript PromiseObservable.PromiseObservable类代码示例

本文整理汇总了TypeScript中rxjs/observable/PromiseObservable.PromiseObservable的典型用法代码示例。如果您正苦于以下问题:TypeScript PromiseObservable类的具体用法?TypeScript PromiseObservable怎么用?TypeScript PromiseObservable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PromiseObservable类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: validateForgotPasswordModal

  validateForgotPasswordModal() {
    console.log('validateForgotPasswordModal');

    // make sure forgotEmail has a value
    let firebaseObs = PromiseObservable.create(this.firebase.sendPasswordResetEmail(this.forgotEmail));

    firebaseObs.subscribe(
      () => {
        console.log("sendPasswordResetEmail ");
        Materialize.toast("Email envoyé", 3000, 'rounded');
        this.cancelForgotPasswordModal();
        this.cd.detectChanges();
      },
      error => {
        /**
         * {code: "auth/invalid-email", message: "The email address is badly formatted."}code: "auth/invalid-email"message: "The email address is badly formatted."__proto__: Error
         *
         * O {code: "auth/user-not-found", message: "There is no user record corresponding to this identifier. The user may have been deleted."}code: "auth/user-not-found"message: "There is no user record corresponding to this identifier. The user may have been deleted."__proto__: Error
         */

        console.log("sendPasswordResetEmail fail reason", error);

        if (error != undefined) {
          if (error.code == "auth/invalid-email") {
            Materialize.toast("L'email n'est pas correctement formatté", 3000, 'rounded');
            return
          } else if (error.code == "auth/user-not-found") {
            Materialize.toast("L'email ne correspond à aucun de nos utilisateurs", 3000, 'rounded');
            return
          }
        }
        Materialize.toast("Une erreur est survenue", 3000, 'rounded');
      }
    ).unsubscribe();
  }
开发者ID:guillaumeLeRoy,项目名称:eritis_fe,代码行数:35,代码来源:welcome-header.component.ts

示例2: fromPromise

 static fromPromise(promise: Promise<any>): Observable<any> {
   return PromiseObservable.create(promise);
 }
开发者ID:UI-TEAM,项目名称:angular,代码行数:3,代码来源:async.ts


注:本文中的rxjs/observable/PromiseObservable.PromiseObservable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。