I'm building a page which will retrieve data dynamically from a Firebase and utilizes Angular routing to serve a dynamic link.
JS:
.controller("IdeaCtrl", ['$scope', '$firebase', '$routeParams', function($scope, $firebase, $routeParams) {
$scope.idea = {
ID: $routeParams.id
};
var ref = new Firebase("https://crowdfluttr.firebaseio.com/ideas/" + $scope.idea.ID);
ref.on("value", function(snapshot) {
console.log(snapshot.val());
var entries = snapshot.val();
$scope.ideaTitle = entries.ideaTitle;
console.log($scope.ideaTitle);
}, function (errorObject) {
console.log("The read failed: " + errorObject.code);
});
}])
HTML:
ID: {{ idea.ID }} <br>
Title: {{ ideaTitle }}
The {{idea.ID}} works, but the {{ideaTitle}} does not show up. Yet, both console.log's work fine. What seems to be the matter?
$timeout. And please read firebase.com/docs/web/libraries/angular/… - Frank van Puffelen$scope.idea = $firebase(ref).$asObject()and thenTitle: {{ idea.ideaTitle }}should be all that is needed. It is documented here: firebase.com/docs/web/libraries/angular/… - Frank van Puffelen