Reputation: 34176
I can't seem to get anything working. How would I update my name?
The firebase.
- users
- my_8_username
- name "Some String"
The controller.
controller('ProfileCtrl', function ($rootScope, $scope, $firebase) {
var id = $rootScope.userId
$scope.name = $firebase(new Firebase(URL + 'users/' + id + '/name'))
$scope.name.$bind($scope, 'name')
})
The markup.
<input ng-model="name" type="text">
Upvotes: 1
Views: 177
Reputation: 40582
You've created a ref to the AngularFire bindings, and then bound a scope variable to the same object. Try this instead:
controller('ProfileCtrl', function ($rootScope, $scope, $firebase) {
var id = $rootScope.userId;
var ref = new Firebase(URL + 'users/' + id + '/name');
$firebase(ref).$bind($scope, 'name');
});
Upvotes: 1