Monday, 15 March 2010

javascript - Passing $scope data to $stateProvider.state resolve -


I have parent state app.Tam.So who stores "team" in $ scope.data.team is. I have $ scope.data.team inside the controller and therefore $ scope.data.team.organization_id

how can I use $ scope.data.team.organization_id inside the resolution ?

  .state ('app.teams.show.games.add', {url: '/ Add', templateUrl: 'templates / schedules / games / add.html', Controller: ' GamesEdeciton ', solve: {org: function ($ http, $ scope) {return $ http.get (' http: / /api.example.com/orgs/'+$scope.data.team.organization_id, {cache} : True});}}}  

I do not think what you can achieve Trying it is the right solution.
In your situation, maybe I will probably pass $ scope.data to Team.organization_id as a parameter for your state and use it in the solve block

  .state ('app.teams.show.games.add', {url: '/ add /: orgId', // or / add? OrgId or: orgId / add templateUrl: 'Templates / Schedule / Games / Edictcode, Controller: 'GamesEdecicon', solve: {org: function ($ http, $ stateParams) {return $ http.get ('http://api.example.com/orgs/'+$stateParams.orgId, {Cache: true});}}})  

No comments:

Post a Comment