Update: Upon further investigation, it appears that value[i].extrainfoimage is only undefined when accessing imageRef.child("-JlSvEAw......
Despite reviewing the documentation multiple times, I still haven't been able to resolve this issue.
Essentially, I fetch data from Firebase and store it in an array. Then, I loop through that array and aim to update certain properties with data retrieved from other locations within my Firebase database. However, every time I attempt to update these properties, I encounter
"Uncaught TypeError: Cannot set property 'extrainfoimage' of undefined"
Here is the code snippet:
var questionsRef = new Firebase("https://XX.firebaseio.com/Questions");
var imageRef = new Firebase("https://XX.firebaseio.com/Images");
// Retrieve the first 6 items
var query = questionsRef.orderByChild('date_time_asked').limitToFirst(6);
// Fetch them as a Firebase array promise
$scope.questions = $firebaseArray(query);
// Wait for the data to load
$scope.questions.$loaded().then(function (value) {
// Iterate through the array
for (i = 0; i < value.length; i++) {
// Check if there is data to be replaced
if (value[i].extrainfoimage) {
// If there is, fetch it from Firebase and replace the property
imageRef.child("-JlSvEAwu5-WZJkOE_b/image").once("value",function(data){
value[i].extrainfoimage = data.val();
});
}
}
})