0
votes

I'm using AngularFire with Firebase. Angular 1 :-( I'm wondering if there is a way to register a callback function that will be fired every time data had successfully saved in the DB.

I know that I can extend $firebaseObject and override $$updated, but this function fired after every local change.

I need a way to know when the data is synchronized with the server.

Let's say that I have a Firebase object named "obj" and I bound it to the scope:

obj.$bindTo($scope, 'obj')

and in my HTML I have:

<input ng-model="obj">

I want the option to change the state of specific $scope variable according to the status of obj (saving / saved).

Is there a way to do this?

1

1 Answers

0
votes

Create another node using a cloud function trigger in your firebase database. So when a file is saved, add under the "userUID" node the file name and a timestamp. Then in your app, add an observable for this specific node and it will confirm you that it has been saved.

-Users
   -userUID
      -fileSent
         - fileName : TimeStamp

I don`t know if it's the best way.. but it's simple.