Anotaciones en Angularfire (Firebase + AngularJS)

martes, 16 de mayo de 2017


FirebaseObject
$save: se aplica al $scope. Se enlaza al $scope primero y luego se realizan acciones necesarias.
//var ref = new Firebase('https://cplearn.firebaseio.com')
var ref = firebase.database().ref();
var vm=this;
vm.object = $firebaseObject(ref.child('example'));
 
vm.initializeObject = function(){
 vm.object.name = "Old name";
 vm.object.title = "Old title";
 vm.object.date = "Old date";
 vm.object.$save();
}
// Function that makes changes an than saves.
vm.changeObject = function () {
 vm.object.name = "New name!";
 vm.object.$save();
};
Referencias:
https://github.com/firebase/angularfire/blob/master/docs/reference.md#save
https://github.com/firebase/angularfire/issues/674
http://plnkr.co/edit/RgcInFVnQx187QDpe7pi?p=preview (incorrecto)
http://plnkr.co/edit/P6Z00NIznO8KLdvkvbCC?p=preview (correcto)

Néstor Mercedes

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comentarios:

Publicar un comentario