I'm currently working with Angular and Firebase. I'm trying to retrieve values from the Datasnapshot
function and assign them to $scope.getData
, but for some reason it's not working as expected. Can anyone help me figure out why? Thank you!
$scope.$on('$routeChangeSuccess', function () {
var firebaseUrl ="https://angular-af216.firebaseio.com";
var commentRef = new Firebase(firebaseUrl).child('User');
commentRef.on('value', function(Datasnapshot) {
var comments = Datasnapshot.val();
// var data = Datasnapshot.child('User').val();
console.log(comments);
console.log("Newline");
$scope.getData = comments;
console.log(getData);
});
});