Ich versuche, die Firebase-Dokumentation zu folgen und ein Bild auf Firebase mit Polymer hochzuladen. DiesePolymer Bild auf Firebase hochladen
ist, was ich habe
_pushToFirebase: function() {
// SLUGGING THE NAME B4 WE EVEN SAVE IT!!
var sluggedname = this._slugify(this.$.crewName.value);
//FOR THE IMAGE
var file = this.$.crewProfilePic.value;
// Upload file
var uploadTask = this.$.query.storageRef.child('/crewprofileimages/' + file.name).put(file);
// Listen for state changes, errors, and completion of the upload.
uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED, // or 'state_changed'
function(snapshot) {
// Get task progress, including the number of bytes uploaded and the total number of bytes to be uploaded
var progress = (snapshot.bytesTransferred/snapshot.totalBytes) * 100;
console.log('Upload is ' + progress + '% done');
switch (snapshot.state) {
case firebase.storage.TaskState.PAUSED: // or 'paused'
console.log('Upload is paused');
break;
case firebase.storage.TaskState.RUNNING: // or 'running'
console.log('Upload is running');
break;
}
}, function(error) {
switch (error.code) {
case 'storage/unauthorized':
// User doesn't have permission to access the object
console.log('You dont have permission to access object');
break;
case 'storage/canceled':
// User canceled the upload
console.log('User cancelled upload');
break;
case 'storage/unknown':
// Unknown error occurred, inspect error.serverResponse
console.log(error.code);
break;
}
}, function() {
// Upload completed successfully, now we can get the download URL
var downloadURL = uploadTask.snapshot.downloadURL;
});
// PUSHING TO FIREBASE
this.$.query.ref.push({
name: this.$.crewName.value,
description: this.$.crewDescription.value,
createddate: new Date().toString(),
creator: this.$.createcrewlogin.user.uid,
slug: sluggedname,
profileimage: downloadURL,
members: {
memberuserid: this.$.createcrewlogin.user.uid,
}
});
},
und die Feuerbasis Abfrage sieht wie folgt aus
<!--STORE THE DATA IN CREWS DEFAULT SECTION-->
<firebase-query
id="query"
data="{{mycrews}}"
path="/crews">
</firebase-query>
Immer, wenn ich einreichen getroffen. Ich erhalte diesen Fehler in meiner Konsole
cannot read property of 'child' of undefined
Wie löse ich das?
Bitte geben Sie einen vollständigen StackTrace des Fehlers, und die Zeilennummer, die es wirft – ZuzEL