Reputation:
Why is AngularFire updating the database just once ?
I'm getting the user as this:
var firebaseURL = "https://..";
angularFire(new Firebase(firebaseURL), $scope, "database").then(function() {
$scope.user = $scope.database.users[0];
});
And in the view:
<input ng-model="user.name" />
When I'm changing the input, it only updates once then never does.
Also, if I change something by using the firebase ui, the model does not update.
Upvotes: 1
Views: 494
Reputation: 34288
Since you are using the angularFire
function in a promise context, the continuation (the then
clause) is run only once and for the initial data. From the docs:
Data from Firebase is loaded asynchronously, you can use the promise to be notified when initial data from the server has loaded.
I suspect you want something of this kind:
angularFire(new Firebase(firebaseURL), $scope, "database");
$scope.$watch("database[0]", function (newVal) {
$scope.user = newVal;
});
Upvotes: 0