本文整理汇总了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)
}