{"action":"opened","issue":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/1936","labels_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1936/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1936/comments","events_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1936/events","html_url":"https://github.com/angular-ui/ui-router/issues/1936","id":73082649,"number":1936,"title":"$stateParams is empty inside Interceptor when using resolve","user":{"login":"sikko","id":951412,"avatar_url":"https://avatars.githubusercontent.com/u/951412?v=3","gravatar_id":"","url":"https://api.github.com/users/sikko","html_url":"https://github.com/sikko","followers_url":"https://api.github.com/users/sikko/followers","following_url":"https://api.github.com/users/sikko/following{/other_user}","gists_url":"https://api.github.com/users/sikko/gists{/gist_id}","starred_url":"https://api.github.com/users/sikko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sikko/subscriptions","organizations_url":"https://api.github.com/users/sikko/orgs","repos_url":"https://api.github.com/users/sikko/repos","events_url":"https://api.github.com/users/sikko/events{/privacy}","received_events_url":"https://api.github.com/users/sikko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-04T17:47:08Z","updated_at":"2015-05-04T17:47:08Z","closed_at":null,"body":"## What I want to achieve:\r\n\r\nSend a token that I get from the url stateParams with every request. For this i'm using an http Interceptor.\r\n\r\nThe interceptor looks like this:\r\n\r\n    .factory('myInterceptor', function($stateParams){\r\n        return {\r\n            request: function(config){\r\n                config.url = config.url + '?text=' + $stateParams.token;\r\n                return config;\r\n            }\r\n        }\r\n    })\r\n\r\n## My problem\r\n\r\nInside the interceptor, the $stateParams is empty when $http is called inside the resolve. However when I call it from inside the controller, it works fine.\r\n\r\n**Working example**:\r\n\r\n> Using $http inside the controller: http://jsfiddle.net/sikko/drLg06w8/8/\r\n\r\n    controller: function ($scope, $http) {\r\n      $http.post('/echo/jsonp').success(function(response){\r\n        $scope.text = response.text;\r\n      });\r\n    }\r\n\r\n**Non Working example**:\r\n\r\n> Using $http inside the resolve: http://jsfiddle.net/sikko/drLg06w8/7/\r\n\r\n    resolve: {\r\n      resolveVar: function($http){\r\n        return $http.post('/echo/jsonp').success(function(response){\r\n          return response.text;\r\n        });\r\n      }\r\n    },\r\n    controller: function ($scope, resolveVar) {\r\n      $scope.text = resolveVar.data.text;\r\n    }\r\n\r\nI did console.log in both examples so you can see that $stateParams is empty when using resolve.\r\n\r\nMy Guess is that the resolve cycle is called before that $stateParams is made available by angular or something like that... But I have no clue how to fix it... Any help would be much appreciated!"}}