This is my code to get the data from server.
sampleApp.controller('OfferController', function ($scope, $state) {
var offersRef = firebase.database().ref('offers');
$scope.offers = [];
offersRef.on('value', function(snapshot) {
$scope.offers = snapshot.val();
//$state.go($state.current, {}, {reload: true});
});
});
Initially $scope.offers = []; is empty. It is getting filled up here. $scope.offers = snapshot.val();
But view is not updating. if i click any button or anything there on the same page, or go back and come again on same page. its getting updated.
Why is not getting updated as soon as data in available? How to fix?