I need to pass the value of a $scope variable from my angular controller to my angular factory, where this value is further being used to do other calculations.
Controller :
angular.module('myApp').controller('MyController',['$scope', function($scope)
{
$scope.selectedValue = function(value)
{
$scope.valueToSend = value + 1000;
}
}]);
Factroy:
angular.module('myApp').factory("Factory", ["$q","$localStorage", function(q, $localStorage)
{
var functionToGetValue = function()
{
return value;
}
}
var x = { .... }
return x;
}]);
The 'value' in my controller is simply a radio button that is been selected.
Within my factory, the variable x has other functions that call my factory function functionToGetValue.
Is there some way I can pass $scope.valueToSend to my factory so that I can further use it there itself??