나는 Ember와 EmberFire에 비교적 새로운입니다. 클라이언트/로고 관리 응용 프로그램을 작성 중입니다. 현재 Firebase 인증 및 Firebase 데이터가 예상대로 작동하고 있습니다. 내가 중포 기지 저장 장치에 로고를 업로드 갈 때,이 오류가되게하고 있습니다 :EmberFire & Firebase Storage Reference
컨트롤러
firebase: Ember.inject.service('firebase'),
actions: {
createClient(){
let name = this.get('clientName');
let image = document.getElementById('client-image');
let storeName = name.replace(/ /g, '');
let storageRef = firebase.storage().ref();
let file = image.files[0];
let metadata = {
'contentType' : file.type
};
let uploadTask = storageRef.child(`uploads/${storeName}/${file.name}`).put(file, metadata);
uploadTask.on('state_changed', null, function(error){
console.error('Upload Failed:', error);
}, function(){
console.log('Uploaded', uploadTask.snapshot.totalBytes, 'bytes.');
console.log(uploadTask.snapshot.metadata);
let uploadUrl = uploadTask.snapshot.metadata.downloadURLs[0];
console.log('File available at ', url);
let client = this.store.createRecord('client', {
name: name,
image: uploadUrl,
isActive: false,
timestamp: new Date().getTime()
});
client.save();
});
// Tell the route to hide the client form.
this.send('hideAddClientForm');
}
}
템플릿 : 여기
Uncaught Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp(). firebase.js:30
가 호출되는 작업입니다
<div id="new-overlay" class="overlay" {{action "hideAddClientForm"}}></div>
<div id="newClient">
{{input type="text" id="client-name" placeholder="Client Name" value=clientName}}<br />
{{input type="file" id="client-image" value=clientImage}}
<div class="submitBtn" {{action "createClient"}}>Add Client</div>
</div>
간단히 말해, EmberFire가 제공 한 Firebase 참조에 액세스하려면 어떻게해야합니까? here in the Quickstart으로 표시된 "storage()"메소드를 호출 할 수 있습니다. 해당 참조에 액세스 할 수없는 경우 저장소를 사용하려면 Firebase에 대한 "EmberFire가 아닌"참조를 새로 만들어야합니까? 나는 단순히 .jpg를 업로드하려고합니다.
필자는'firefox.initializeApp()'를 시도해 보았습니다.'귀하의 API 키는 유효하지 않습니다. 올바르게 복사했는지 확인하십시오. '라고 말했을 것입니다. 인증 및 데이터베이스 항목은 다음과 같습니다. 잘 작동하고있어, 작동하지 않는 파일 저장소 일뿐입니다. –