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


TypeScript MdSnackBar.open方法代码示例

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


在下文中一共展示了MdSnackBar.open方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:

 val => {
     if(val.created === true || val.result === 'updated') {
         this.snackBar.open('query saved.', '', {
             duration: 2000
         })
     }else{
         this.snackBar.open('error: query not saved.', '', {
             duration: 2000
         })
     }
 });
开发者ID:yeg-relief,项目名称:screenerClient,代码行数:11,代码来源:query-edit-v3.component.ts

示例3: validateFields

 validateFields(title, description, price) {
   if (!title) {
     let snackBarRef = this.snackBar.open('You must add a title for this product', 'OK!', {
       duration: 3000
     });
   } else if (!description) {
     let snackBarRef = this.snackBar.open('You must add a description to the product', 'OK!', {
       duration: 3000
     });
   } else if (!price) {
     let snackBarRef = this.snackBar.open('You must add a price to the product', 'OK!', {
       duration: 3000
     });
   }
 }
开发者ID:mogeta,项目名称:firebase-cms,代码行数:15,代码来源:add-product.component.ts

示例4: if

 .subscribe(val => {                
     if (val.status === true){
         this.cacheQuery(this.searchForm.controls.searchitem.value)
         let adj:string = val.content.length <= 1 ? "result" : "results";
         let msg:string = `${val.content.length} ${adj} found`
         this.snackbar.open(msg,"View")
         this.snackbar._openedSnackBarRef.onAction().subscribe(() =>{
             this.resultDialog.open(SearchResultDialogComponent,{
                 height:'35rem',width:'65rem',data:val.content.content
             })                        
         })
     }else if (val.status === false){
         this.snackbar.open("Nothing found","Close",{duration:1000})                    
     }                
 })
开发者ID:daviddexter,项目名称:wajibu,代码行数:15,代码来源:top.box.component.ts

示例5: validateFields

 validateFields(url: string, title: string, body: string) {
   if (!url) {
     let snackBarRef = this.snackBar.open('You must add a URL for this page', 'OK!', {
       duration: 3000
     });
   } else if (!title) {
     let snackBarRef = this.snackBar.open('You must add a title for this page', 'OK!', {
       duration: 3000
     });
   } else if (!body) {
     let snackBarRef = this.snackBar.open('You must add content to the page', 'OK!', {
       duration: 3000
     });
   }
 }
开发者ID:mogeta,项目名称:firebase-cms,代码行数:15,代码来源:add-page.component.ts

示例6: addCategory

  addCategory(newName: string, newWeight: number) {
    if (newName) {
      let categoryObject = {
        name: newName,
        weight: newWeight,
        slug: this.globalService.slugify(newName),
        dateUpdated: Date.now().toString(),
        rdateUpdated: (Date.now() * -1).toString(),
        updatedBy: this.currentAdmin.uid,
        entityKey: this.editMode && this.categoryKey ? this.categoryKey : null,
        products: this.newProducts ? this.newProducts : null
      };

      if (this.editMode && this.categoryKey) {
        this.db.object('/categories/' + this.categoryKey).update(categoryObject);
      } else {
        this.categories.push(categoryObject).then((item) => {
          this.db.object('/categories/' + item.key + '/entityKey').set(item.key);
        });
      }

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

    }
    this.validateFields(newName);
  }
开发者ID:mogeta,项目名称:firebase-cms,代码行数:28,代码来源:add-product-category.component.ts

示例7: validateFields

 validateFields(name: string) {
   if (!name) {
     let snackBarRef = this.snackBar.open('You must add a name for this category', 'OK!', {
       duration: 3000
     });
   }
 }
开发者ID:mogeta,项目名称:firebase-cms,代码行数:7,代码来源:add-product-category.component.ts

示例8: if

    dialogRef.afterClosed().subscribe(result => {
      this.selectedOption = result;
      if (this.selectedOption === 'approve') {
        if (entityObject.entityKey) {
          let ogEntity = this.db.object('/' + entity + '/' + entityObject.entityKey);
          ogEntity.valueChanges().take(1).subscribe((item:any) => {
            if (entity === 'products' && item.category && entityObject.category) {
              this.db.object('/categories/' + item.category + '/products/' + entityObject.entityKey).remove();
              this.db.object('/categories/' + entityObject.category + '/products/' + entityObject.entityKey).set(Date.now().toString());
            } else if (entity === 'products' && item.category && !entityObject.category) {
              this.db.object('/categories/' + item.category + '/products/' + entityObject.entityKey).remove();
            } else if (entity === 'products' && !item.category && entityObject.category) {
              this.db.object('/categories/' + entityObject.category + '/products/' + entityObject.entityKey).set(Date.now().toString());
            }
            ogEntity.set(entityObject);
          });
        } else {
          this.db.list('/' + entity).push(entityObject).then((item) => {
            if (entity === 'products' && entityObject.category) {
              this.db.object('/categories/' + entityObject.category + '/products/' + item.key).set(Date.now().toString());
            }
          });
        }

        this.db.object('/approvals/' + entity + '/' + ogKey).remove();
        let snackBarRef = this.snackBar.open('Item approved', 'OK!', {
          duration: 3000
        });
      }
    });
开发者ID:mogeta,项目名称:firebase-cms,代码行数:30,代码来源:admin-approvals.component.ts

示例9: showMessage

    protected showMessage(message: string, actionLabel?: string): void {
        if (!isPresent(actionLabel)) {
            actionLabel = 'OK';
        }

        this.snackBar.open(message, actionLabel, new MdSnackBarConfig());
    }
开发者ID:Invis1ble,项目名称:assistant-client,代码行数:7,代码来源:abstract-component.ts

示例10:

    dialogRef.afterClosed().subscribe(result => {
      this.selectedOption = result;
      if (this.selectedOption === 'delete') {
        this.db.object('/products/' + product.key).remove();
        if (product.category) {
          this.db.object('/categories/' + product.payload.val().category + '/products/' + product.key).remove();
        }

        // if (product.thumbnail) {
        //   let storage = firebase.storage();
        //   let imageRef = storage.refFromURL(product.thumbnail);
        //   let me = this;
        //   imageRef.delete().then(function() {
        //     let snackBarRef = me.snackBar.open('Product deleted', 'OK!', {
        //       duration: 3000
        //     });
        //   }).catch(function(error) {
        //     console.log('error', error);
        //   });
        // } else {
          let snackBarRef = this.snackBar.open('Product deleted', 'OK!', {
            duration: 3000
          });
        // }
      }
    });
开发者ID:mogeta,项目名称:firebase-cms,代码行数:26,代码来源:admin-products.component.ts


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