如何在angular js factory方法中传递$ scope变量 [英] How to pass the $scope variable in angular js factory method
本文介绍了如何在angular js factory方法中传递$ scope变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
angular.forEach(values, function($http, $scope)
{
this is my loop
})
module.factory('userService',
function(){
here i want to pass that looping Scope variable
});
我尝试过:
i想要从我的循环本身推送Scope变量我需要在Angular工厂方法中获取Scope变量。有什么办法请发给我链接或代码
What I have tried:
i want to push the Scope variable from my loop itself i need to get the Scope variable in Angular factory method . is there any way please send me that link or code
推荐答案
http,
范围)
{
这个是我的循环
})
module.factory(' < span class =code-string> userService',
function (){
这里我想传递那个循环范围变量
});
scope) { this is my loop }) module.factory('userService', function(){ here i want to pass that looping Scope variable });
我尝试过:
i想从我的循环本身推送Scope变量我需要在Angular工厂方法中获取Scope变量。有什么办法请发给我链接或代码
What I have tried:
i want to push the Scope variable from my loop itself i need to get the Scope variable in Angular factory method . is there any way please send me that link or code
我想你可以把它作为参数传递:
I guess you could pass it as a parameter:
module.factory('userService',
function(){
userService.doSomething = function(scope,item){
};
});
然后
then
module.module('mod',['
这篇关于如何在angular js factory方法中传递$ scope变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文