在app.module中
AngularFireModule.initializeApp(environment.firebaseConfig)
我有两个存储设备
firebaseConfig: {
apiKey: 'AIzaSyBHsAxVgiuM0_xLd3BunTG6Yf9x1nynxoA',
authDomain: 'careerograph-e9963.firebaseapp.com',
databaseURL: 'https://careerograph-e9963.firebaseio.com',
projectId: 'careerograph-e9963',
storageBucket: 'careerograph-e9963.appspot.com',
messagingSenderId: '669874223858'
},
firebaseExcelConfig: {
apiKey: 'AIzaSyBHsAxVgiuM0_xLd3BunTG6Yf9x1nynxoA',
authDomain: 'careerograph-e9963.firebaseapp.com',
databaseURL: 'https://careerograph-e9963.firebaseio.com',
projectId: 'careerograph-e9963',
messagingSenderId: '669874223858',
storageBucket: 'careerograph-excel',
},
在组件中,我在构造函数中注入了一个私有的 storage:AngularFireStorage,然后调用。
this.task = this.storage.upload(this.path, file, { customMetadata });
如何选择一个桶并将文件上传到其中