Reputation: 2158
What is stopping my view from being rendered after my "User" service is updated with the information necessary to view?
Pseudocode:
- User signs in and the profile.uid information should be set. The profile.uid is later used as a child in my Firebase path.
.factory('User', function (FirebaseUrl, $firebaseArray) {
var o = {};
o.setUser = function(authData) {
o.profile.uid = authData.uid;
}
o.getProfile = function() {
return o.profile;
}
return o;
}
- Using $state.go('view') with Angular UI-Router I go to the following view:
Controller:
.controller('viewCtrl', function ($scope, User, $firebaseArray, FirebaseUrl) {
var profile = User.getProfile();
//if I hardcore "facebook:213032130516" in the .child(), everything renders correctly...
var messagesRef = new Firebase(FirebaseUrl + 'user_meta/').child(profile.uid);
var query = messagesRef.orderByChild("timestamp").limitToLast(5);
$scope.list = $firebaseArray(query);
}
HTML:
<div ng-repeat="dog in list">
<h2> {{dog.key}}</h2>
</div>
As it stands currently, the view doesn't render. No errors are logged, just the view is blank. As per the comment in the controller code, when I hardcode the .child(profile.uid), so it becomes .child('facebook:112351), the view renders correctly.
Can someone help me with a better solution to implement, and ultimately, why this is not working?
Thanks!
Upvotes: 0
Views: 88
Reputation: 487
It is hard to be 100% sure by just looking at this two pieces of code, but I would assume that you don't pass the data when you call setUser somewhere else. Try to log it out and see where you lose it. Do you have a github repo of this project that we could look at?
Upvotes: 1