i am using firebase database to store data and firebase storage to store images. i have a libraries node and an image associated with that library.
i want to delete a library and it's associated image. i manage to do both but not in a logical manner because i get undefined.
this is my code:
let thisLibImagePath = this.libService.getLibImagePlace(id);
var libsStorageRef = firebase.storage().ref('images/libs/');
// Create a reference to the image we need to delete
var LimageRef = libsStorageRef.child(thisLibImagePath);
// Delete the file
this line, which delete the library from the database, doesn't work within the promise, where it should be logical. i get the error that this.libraries is undefined. but if i use the same code at the end, it does recognize this.libraries. so i can delete it at the end, i just don't understand why within the scope of the promise, i can't use it.
what am i missing?