Click here to Skip to main content
15,915,611 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
angular.forEach(values, function($http, $scope)
{ 
      this is my loop
})
module.factory('userService',
 function(){ 
 here i want to pass that looping Scope variable
 });


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
Posted
Updated 12-Oct-16 2:56am
v2

1 solution

I guess you could pass it as a parameter:

JavaScript
module.factory('userService',
 function(){ 
     userService.doSomething = function(scope,item){
     
     };
 });


then
JavaScript
module.module('mod',['$scope','userService', function($scope,userService){ 

     userService.doSomething($scope,{});
 });
 
Share this answer
 
Comments
Karthik_Mahalingam 13-Oct-16 0:54am    
5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900