Angularjs & Firebase '$timeout Is Not Defined'
Hey guys I have just been learning about angular JS and Firebase and for some reason I seem to be getting a Reference Error when I try to call the $timeout function in the followin
Solution 1:
You need declare $timeout
to use it same as:
angular.module('drivenApp')
.controller('MainCtrl', function ($scope, $timeout) {
var rootRef = new Firebase('https://vivid-torch-5432.firebaseio.com/');
var childRef = rootRef.child('message');
childRef.on('value', function(snapshot){
$timeout(function() {
var snapshotVal = snapshot.val();
console.log(snapshotVal);
$scope.message = snapshot.val();
});
});
});
Post a Comment for "Angularjs & Firebase '$timeout Is Not Defined'"