Is it possible to listen for Firebase server updates on the DOM in AngularFire?
I want to be able to fetch any updates when they are returned from the server to update the values of an array. Basically my problem is that I am using Firebase.ServerValues.TIMESTAMP
which is set by the server.
Furthermore, why can't I use new Date()
to create a client timestamp?
You can extend the
$firebaseArray
and$firebaseObject
specifically for that purpose. See https://www.firebase.com/docs/web/libraries/angular/guide/extending-services.htmlWhen you call
new Date()
it creates aDate
object, which is not a JSON type. If you're looking to store the current timestamp, you can get that byDate.now()
.