I made a applicaion for show information from Firebase with AnguarJS. For this moment, information is updated after refresh page, but i want to update my information in real time.
Here is my angular code:
var root = angular.module('root',["services", "firebase"]); root.controller("root4",['$sce', "$scope", function($sce,$scope){ var ref = new Firebase("https://web-quickstart-8326d.firebaseio.com"); var locationRef = rootRef.child('location'); locationRef.once("value", function(snapshot) { $scope.value = snapshot.val(); $scope.$apply(); if($scope.value=="col6"){ var currentMessageRef = rootRef.child('currentMessage'); currentMessageRef.once("value", function(snapshot) { $scope.html = snapshot.val(); $scope.trustedHtml = $sce.trustAsHtml($scope.html); }); } else if($scope.value!="col6"){ $scope.html = "No value in db"; $scope.trustedHtml = $sce.trustAsHtml($scope.html); } }); }]); I insert in my code a condition for post information, but that's not important... all i want it's to update information in real time without reload my page.
Thank you for help!
$scope.$apply()after assigning the scope variables that are not displayed in real time? See also stackoverflow.com/questions/38366955/…