Good day, I am having some pretty heavy complications with using an ng-click; linked to a controller and calling a service from there in a separate js file. The .factory Service function is one of many inside of services.js which use the arguments: userId, itemType, itemId, and rating, and yet, this particular function uses these arguments to create a directory reference to .set to firebase. All of the arguments I previously mentioned though, are going to firebase as undefined. I believe that I need assistance in how to define the variables. Here is all of the necessary code, and thank you.
The first input of the html:
<div class="ratings form-group" ng-controller="rateCtrl">
<input id="rate1" ng-click="rate(userId, itemType, itemId, rating)" value="1" class="rate rate1 form-control" title="1" type="radio" name="rate"/>
The controller:
.controller('rateCtrl', ['$scope', 'ratingsService', function($scope, ratingsService) {
rate();
}
])
The .factory service:
.factory('ratingsService', function() {
return {
rate: function(userId, itemType, itemId, rating) {
// @todo Construct a new promise that resolves when both Firebase operations have been performed.
console.log("SUCCESS!");
$firebase( new Firebase(dvUrl + '/users/' + userId + '/ratings/' + itemType + '/' + itemId) ).$set(rating);
$firebase( new Firebase(dvUrl + '/' + itemType + '/' + itemId + '/ratings/' + userId) ).$set(rating);
}
})