I have a $rootscope object defined in the run like so..
//Start the AngularJS App
var angularApp = angular.module('angularApp')
//Run at the start of the Angular Application
.run(function ($rootScope, $location, $firebase, $firebaseSimpleLogin) {
//Create the User Object.
$rootScope.user = $firebase($rootScope.fb.child('/persons/person1'));
//this works fine!
console.log($rootScope.user.userId)
});
$rootScope.user holds userId, userName, userEmail, etc...
Later, in a controller, I want to use some data in $rootScope.user but its undefined!
function myCtrl($rootScope, $scope) {
//need to use $rootsope.user.userId in this command...
$scope.folders = $firebase($rootScope.fb.child('/persons/' + $rootScope.user.userId);
//this will display the $rootScope in the console no problem!
console.log($rootScope);
//this just displays 'undefined'
console.log($rootScope.user);
};
What is driving me insane is that when myCtrl displays the $rootScope in chrome javascript console, I can expand the object and SEE the user object!!!
But the second console.log is just undefined. please help!