$scope.list = function() {
fbAuth = fb.getAuth();
if(fbAuth) {
var sync = $firebase(fb.child("users/" + fbAuth.uid));
var syncObject = sync.$asObject();
syncObject.$bindTo($scope, "data");
}
}
Once syncObject is bound to $scope.data, which is provided by AngularFire, data will be synchronized consistently in three ways (UI, $scope.data, and Firebase): Calling $scope.data.todos.push({title: result}); will update the UI and also sync it to Firebase; no further code adjustments are required.