當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript FirebaseApp.storage方法代碼示例

本文整理匯總了TypeScript中angularfire2.FirebaseApp.storage方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FirebaseApp.storage方法的具體用法?TypeScript FirebaseApp.storage怎麽用?TypeScript FirebaseApp.storage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angularfire2.FirebaseApp的用法示例。


在下文中一共展示了FirebaseApp.storage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

  constructor(
    public af: FirebaseApp,
    public db: AngularFireDatabase,
    public snackBar: MdSnackBar,
    public globalService: GlobalService,
    public router: Router,
    public route: ActivatedRoute,
    private fb: FirebaseApp,
    public dialog: MdDialog
  ) {
    this.newPublished = false;
    this.products = db.list('/products');
    this.categories = db.list('/categories').snapshotChanges();

    this.globalService.admin.subscribe(admin => {
      this.currentAdmin = admin;

      let adminApprovalProducts = this.db.list('/approvals/products/', ref => ref.orderByChild('updatedBy').equalTo(this.currentAdmin.uid));
      adminApprovalProducts.valueChanges().subscribe(response => {
        console.log(!response);
      });
    });

    this.storageRef = af.storage().ref();
  }
開發者ID:mogeta,項目名稱:firebase-cms,代碼行數:25,代碼來源:add-product.component.ts

示例2: uploadAndSave

  public uploadAndSave(item: any) {
    let contact = { $key: item.key, name: item.name, url: '', fullPath: '' };

    if (contact.$key) {
      this.save(contact);
    } else {
      let storageRef = this.fb.storage().ref();
      let basePath = '/contacts/' + this.angularFireAuth.auth.currentUser.uid;
      contact.fullPath = basePath + '/' + contact.name + '.png';
      let uploadTask = storageRef.child(contact.fullPath).putString(item.fileToUpload, 'base64');

      uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED,
      (snapshot) => {
        var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
        console.log(progress + "% done");
      },
      (error) => {
        console.error(error);
      },
      () => {
        contact.url = uploadTask.snapshot.downloadURL;
        this.save(contact);
      });
    }
  }
開發者ID:joaorobertoifrn,項目名稱:ionicfirebaseauth,代碼行數:25,代碼來源:contact-service.ts

示例3: constructor

  constructor(
    public af: FirebaseApp,
    public db: AngularFireDatabase,
    public globalService: GlobalService,
    public router: Router,
    public dialog: MdDialog,
    public snackBar: MdSnackBar
  ) {
    this.products = db.list('/products', ref => ref.orderByChild('rdateUpdated').limitToLast(9999)).snapshotChanges();
    this.storageRef = af.storage().ref();

    this.globalService.admin.subscribe((a) => {
      this.currentAdmin = a;
    });
  }
開發者ID:mogeta,項目名稱:firebase-cms,代碼行數:15,代碼來源:admin-products.component.ts

示例4: constructor

  constructor(
    public af: FirebaseApp,
    public db: AngularFireDatabase,
    public globalService: GlobalService,
    public router: Router,
    public dialog: MdDialog,
    public snackBar: MdSnackBar
  ) {
    this.posts = db.list('/posts').snapshotChanges();

    this.storageRef = af.storage().ref();

    this.globalService.admin.subscribe((a) => {
      this.currentAdmin = a;
    });
  }
開發者ID:mogeta,項目名稱:firebase-cms,代碼行數:16,代碼來源:admin-posts.component.ts

示例5: constructor

  constructor(
    public af: FirebaseApp,
    public db: AngularFireDatabase,
    public snackBar: MdSnackBar,
    public globalService: GlobalService,
    public router: Router,
    public route: ActivatedRoute,
    private fb: FirebaseApp,
    public dialog: MdDialog
  ) {

    this.newPublished = false;
    this.posts = db.list('/posts');

    this.globalService.admin.subscribe(admin => {
      this.currentAdmin = admin;
    });

    this.storageRef = af.storage().ref();
  }
開發者ID:mogeta,項目名稱:firebase-cms,代碼行數:20,代碼來源:add-post.component.ts

示例6: removeFile

 public removeFile(fullPath: string) {
   let storageRef = this.fb.storage().ref();
   storageRef.child(fullPath).delete();
 }
開發者ID:joaorobertoifrn,項目名稱:ionicfirebaseauth,代碼行數:4,代碼來源:contact-service.ts

示例7: getUploadRef

 getUploadRef(path) {
   return this.fbA.storage().ref().child(path)
 }
開發者ID:mmilad,項目名稱:community,代碼行數:3,代碼來源:firebase.service.ts


注:本文中的angularfire2.FirebaseApp.storage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。