Angularjs share functions inside service

前端 未结 1 1086
孤城傲影
孤城傲影 2021-01-25 08:58

I am working with an angular app, where service are as declared as follows:

App.service(\"myService\", function(){
  this.         


        
相关标签:
1条回答
  • 2021-01-25 09:51

    Just declare it outside the calculation1 function:

    App.service("myService", function(){
      var util = function(){
      }
      this.calculation1 = function(){
        //doing something
      }
      this.calculation2 = function(){
    
      }
    }
    
    0 讨论(0)
提交回复
热议问题