在services.js
里,我创建了一个一个service叫http_handle
:
.service('http_handle', function($rootScope,$ionicPopup,$http,$ionicModal,ionicToast) {
var self =this;
self.handle= function (data,$scope) {
if (data.err) {
alert(data.err.message);
return;
}
};
});
然后我想在另一个js文件的一个函数里调用到http_handle
的handle
这个方法:(注:这只是一个普通的js文件,在angular的框架范围之外)
function callback(type, data) {
alert(type+" " + data);
//调用http_handle.handle
}
可以如何才能获取到http_handle
这个service对象呢?