Ionic2 with Real-time data not updating(firebase)

Heads up: here’s the probable cause for the issues in beta.4 (details in the linked post):

Therefore anyone using beta.4 should update to beta.6 where the issues are fixed:

However, there are still similar issues caused by a zone.js bug (details in the linked post):

I can confirm that this solved the problem. For me, anyway :slight_smile:
Removed the ngZone workaround and my app still works on the device. Great work!

1 Like

Hi, I have one issue. when run typings install --save --ambient firebase, then display no dependencies.
Plz help me.

I am using ionic beta 7 and still the list does not refresh automatically. ChangeDetectorRef.detectChanges() fixed the issue. Thanks for posting it here.

I think you’ve put a band-aid on a more serious wound. You are probably going to have other problems until you figure out what is really going on.

1 Like

you were right rapropos. I had to remove the call to ChangeDetectorRef.detectChanges() as it was firing numerous times and making the application slow.
Is there any other solution for this?

@vasanth19 In case that you updated your project from an earlier version of the framework I would suggest to check if you performed the update properly. If you missed something by the update, it might result in such problems. Check out the following post for more details:

1 Like

Hello iignatov,
I downloaded the fresh copy of ionic conference app and added my code into it. it already had the ionic beta 7 in it.

I am having the exact same problem. Do you know why it works fine without the ChangeDetectorRef on browser but not on device?

Difficult to say without seeing the code, however I would suggest you to first update your project to beta.8 and check if the problem still exists.

Was there any update on this topic? I am seeing the same issue described here in Ionic 2.0.1 using latest Firebase and latest Angularfire2. I have tried to update an Angularfire list and also used a firebase.ref().on, but neither way updates without interacting with the UI first. I’m using limitToFirst(limit), then trying to update the limit to increase the number of values in my array.

initializePhotos(limit){
  	this.albumRef = firebase.database().ref('/Weddings/0/weddingAlbums/' + this.album.$key + '/albumPhotos').limitToFirst(limit);
  	this.albumRef.on('value', photoList => {
  	let photos = [];
  		photoList.forEach( photo => {
    		photos.push(photo.val());
  		});
  		this.photoList = photos;
  	});
  	return this.photoList;
  }

  loadMorePhotos(limit){
	this.limit = this.limit + limit;
	this.initializePhotos(this.limit);
  }

i had the same issue, can you see the change in console log?, if so, I solved it using ngzone