First of all I want to make a plunkr for this but code is so complex and reproducing this may cost a lots of time.
But I am gonna attach pictures about this problem.
Problem is:
Data is coming perfectly from database, and its assigning the data to array but somehow view is not updating.
- I have an array of objects. So i used firebaseArray for this.
This is my first array
I am checking data on
Console.Logand its coming, its changing...$timeout,setTimeoutdoesn't working...var ref = firebase.database().ref("live"); var liveData = $firebaseArray(ref);
EXAMPLE CHANGED EVENT:
ref.child("events").on("child_changed", function(snapshot) {
// CHANGE EVENTS
var changedData = snapshot.val();
angular.forEach(liveData[0], function(i,v) {
if (angular.isObject(i)) {
if (i.id == changedData.id) {
$timeout(function() {
i = changedData;
console.log(i);
console.log("1 event has been changed");
}, 100);
}
}
});
});
I am new and this is my first project with Firebase&AngularFire.
Maybe I did something wrong, maybe I am doing all wrong but I don't know what...
BTW this is service not controller, I am not/can not using SCOPE.
This data is so complex, I am gonna show you our view so you can understand better..
<div ng-repeat="tournament_id in sport.tournaments track by $index"
ng-if="(live.data.tournaments[tournament_id] && live.isCollapsed('sports', sport.id))">
<div class="main-box">
<h4 class="tournament-name" ng-click="live.manageCollapse('tournaments', tournament_id)">
<i class="fa fa-chevron-up {{live.storage.tournaments[tournament_id].style}}"></i>
{{live.data.tournaments[tournament_id].name}} ({{live.data.tournaments[tournament_id].event_count}})
</h4>
<div ng-if="live.isCollapsed('tournaments', tournament_id)">
<table class="table">
