how can i extend a service

后端 未结 6 1322
Happy的楠姐
Happy的楠姐 2020-12-08 07:00

I am fairly new to angularjs and am not able to find any documentation or examples for this. What I am looking to do is to extend a basic service so that i can use the metho

6条回答
  •  粉色の甜心
    2020-12-08 07:28

    More cleaner and imperative way

    .factory('ExtendedService', function($http, BasicService){
    
        var extended = angular.extend(BasicService, {})
        extended.method = function() {
            // ...
        }
        return extended;
    }
    

提交回复
热议问题