As a newcomer to angularjs
, I am struggling to find documentation or examples on how to extend a basic service in order to utilize its methods from other services. For example, consider the following basic service:
angular.module('myServices', []).
factory('BasicService', function($http){
var some_arg = 'abcd'
var BasicService = {
method_one: function(arg=some_arg){ /*code for method one*/},
method_two: function(arg=some_arg){ /*code for method two*/},
method_three: function(arg=some_arg){ /*code for method three*/},
});
return BasicService;
}
);
Now, I want to create an Extended service that extends the functionality of the above BasicService
so I can access its methods within my extended service. Perhaps something like this:
factory('ExtendedService', function($http){
var ExtendedService = BasicService();
ExtendedService['method_four'] = function(){/* code for method four */}
return ExtendedService;
}