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


TypeScript service.GlobalService.hashCode方法代码示例

本文整理汇总了TypeScript中app/services/global.service.GlobalService.hashCode方法的典型用法代码示例。如果您正苦于以下问题:TypeScript service.GlobalService.hashCode方法的具体用法?TypeScript service.GlobalService.hashCode怎么用?TypeScript service.GlobalService.hashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app/services/global.service.GlobalService的用法示例。


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

示例1: addAdmin

  addAdmin(newEmail: string, newRole: string) {
    if (newEmail && newRole) {

      this.db.object('/admins/' + this.globalService.hashCode(newEmail)).update({
        email: newEmail,
        role: newRole
      });

      this.newEmail = null;
      this.newRole = null;

      let snackBarRef = this.snackBar.open('Admin saved', 'OK!', {
        duration: 3000
      });

    } else if (!newEmail) {
      let snackBarRef = this.snackBar.open('You must add an email for the user', 'OK!', {
        duration: 3000
      });
    } else if (!newRole) {
      let snackBarRef = this.snackBar.open('You must add a role for the user', 'OK!', {
        duration: 3000
      });
    }
  }
开发者ID:mogeta,项目名称:firebase-cms,代码行数:25,代码来源:add-admin.component.ts

示例2:

 this.user.subscribe(currentUser => {
   if (!currentUser) {
     this.router.navigateByUrl('login');
   } else {
     this.db.object('/admins/' + this.globalService.hashCode(currentUser.email)).valueChanges().subscribe((a:any) => {
       if (a && a.email) {
         this.globalService.admin.next(currentUser);
         this.db.object('/admins/' + currentUser.uid).valueChanges().subscribe((a:any) => {
           this.globalService.admin.next(a);
           this.currentAdmin.role = a.role;
         });
       } else {
         this.router.navigateByUrl('');
         let snackBarRef = this.snackBar.open('You are not an authorized administrator', 'OK!', {
           duration: 3000
         });
       }
     }, (err) => {
       console.log('Permission Error', err);
       this.router.navigateByUrl('');
       let snackBarRef = this.snackBar.open('You are not an authorized administrator', 'OK!', {
         duration: 3000
       });
     });
   }
 });
开发者ID:mogeta,项目名称:firebase-cms,代码行数:26,代码来源:admin.component.ts

示例3: confirm

 confirm() {
   this.submitNewCharge();
   let newKey = Math.abs(this.globalService.hashCode(this.order.date) + this.globalService.hashCode(this.order.shipping.email));
   this.db.list('/orders').push(this.order).then((item) => {
     this.globalService.cart.next(null);
     this.globalService.order.next(null);
     this.localCart.clearAll();
     if (this.user) {
       this.db.object('/users/' + this.user.uid + '/cart').remove();
       this.db.object('/users/' + this.user.uid + '/orders/' + item.key).set(Date.now().toString());
     }
     this.router.navigateByUrl('checkout/confirmation');
   });
 }
开发者ID:mogeta,项目名称:firebase-cms,代码行数:14,代码来源:checkout-review.component.ts


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