I am making a factory with multiple functions. Structure is like following:
app.factory('Service', function() {
var Service = {};
Service.method1 = function($scope) {
//logic
return something1
};
Service.method2 = function($scope) {
return something2
};
Service.method3 = function($scope) {
return something3
};
Service.method4 = function($scope, Service) {
var object1 = Service.method1($scope)
var object2 = Service.method2($scope)
var object3 = Service.method3($scope)
//do something with object 1,2,3 and return the result
return result
};
Is this a right way of using a function in a factory inside other function in a factory? And I'm not sure whether I can just pass $scope like that.