Thursday, 12 September 2013

How to update when using angularFireCollection instead of angularFire?

How to update when using angularFireCollection instead of angularFire?

I have read the docs and I see there is an update method. However I am not
having any luck with it. I get "Cannot call method 'update' of undefined".
I can however change update to 'add' and the function works. I am doing
something wrong, I just don't know what..
Here is my code:
(function() {
'use strict';
angular.module('myApp').controller('MainCtrl',['$scope','angularFireCollection',
function($scope, angularFireCollection) {
var url = 'https://myapp.firebaseio.com/genre';
$scope.genres = angularFireCollection(new Firebase(url), $scope,
'genres');
$scope.vote = function(){
this.artist.votes=this.artist.votes + 1;
$scope.genres.update(this); // this update is not working.
}
}]);
}).call(this);
Thanks for your help.

No comments:

Post a Comment