本文整理匯總了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();
}
示例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);
});
}
}
示例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;
});
}
示例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;
});
}
示例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();
}
示例6: removeFile
public removeFile(fullPath: string) {
let storageRef = this.fb.storage().ref();
storageRef.child(fullPath).delete();
}
示例7: getUploadRef
getUploadRef(path) {
return this.fbA.storage().ref().child(path)
}