angularjs - Confusion about the AngularFire() controller -
so after getting used angularfire these last few days, stumbled upon angularfire() constructor.
i calling @ moment :
angularfire(new firebase(fburl + '/users' + $scope.auth.id), $scope, 'user');
if understand correctly, first argument url points current logged in user (assuming login works correctly off course, does).
the second argument fact want bind scope.
the third argument stringified name of scope, correct?
i got angularfire constructor following tutorial: http://www.thinkster.io/angularjs/ehpcs7s87o/angularjs-tutorial-learn-to-rapidly-build-real-time-web-apps-with-firebase#item-526c8aae0717fcb66f00020f
$scope.$on('angularfireauth:login', function() { angularfire(new firebase(fburl+'/users/'+$scope.auth.id), $scope, 'user'); });
now did this:
console.log($scope.auth.id); //prints 16, @ location there user console.log($scope.user) //prints undefined
i expecting $scope.user holds user object, because @ link indeed user object. after trying pass in '{}' 4th argument explicitly ask object still fails.
i'm not familiar constructor you're using. should using $firebase function set bindings.
$scope.user = $firebase(new firebase(fburl + '/users/' + $scope.auth.id))
take @ https://www.firebase.com/quickstart/angularjs.html quick walk through.
Comments
Post a Comment