内部服务Angularjs份额功能 [英] Angularjs share functions inside service
本文介绍了内部服务Angularjs份额功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我与角度的应用程序,其中服务作为声明如下工作
I am working with an angular app, where service are as declared as follows:
App.service("myService", function(){
this.calculation1 = function(){
var util = function(){
}
//doing somthing
}
this.calculation2 = function(){
// how can I call util function here?
}
}
我想UTIL功能的使用方法calculation2里面。
I want to use util function inside calculation2 method.
我怎么能这样做?
先谢谢了。
推荐答案
刚刚宣布它的计算1
函数之外:
Just declare it outside the calculation1
function:
App.service("myService", function(){
var util = function(){
}
this.calculation1 = function(){
//doing somthing
}
this.calculation2 = function(){
// how can I call util function here?
}
}
这篇关于内部服务Angularjs份额功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文