I am looking to transfer the value of a $scope variable from my angular controller to my angular factory, where this value will be used for additional calculations.
Controller :
angular.module('myApp').controller('MyController',['$scope', function($scope)
{
$scope.selectedValue = function(value)
{
$scope.valueToSend = value + 1000;
}
}]);
Factory:
angular.module('myApp').factory("CustomFactory", ["$q","$localStorage", function(q, $localStorage)
{
var getValueFunction = function()
{
return value;
}
}
var x = { .... }
return x;
}]);
The 'value' in my controller is simply a radio button that has been selected.
In the factory, the variable x contains other functions that utilize the function getValueFunction
.
Is there a method to pass $scope.valueToSend to my factory so I can utilize it within the factory itself??