{"action":"opened","issue":{"url":"https://api.github.com/repos/johnpapa/generator-hottowel/issues/150","labels_url":"https://api.github.com/repos/johnpapa/generator-hottowel/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/johnpapa/generator-hottowel/issues/150/comments","events_url":"https://api.github.com/repos/johnpapa/generator-hottowel/issues/150/events","html_url":"https://github.com/johnpapa/generator-hottowel/issues/150","id":129793130,"number":150,"title":"Error with resolve in ui-router, using preconfigured router","user":{"login":"kunzai","id":2081844,"avatar_url":"https://avatars.githubusercontent.com/u/2081844?v=3","gravatar_id":"","url":"https://api.github.com/users/kunzai","html_url":"https://github.com/kunzai","followers_url":"https://api.github.com/users/kunzai/followers","following_url":"https://api.github.com/users/kunzai/following{/other_user}","gists_url":"https://api.github.com/users/kunzai/gists{/gist_id}","starred_url":"https://api.github.com/users/kunzai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunzai/subscriptions","organizations_url":"https://api.github.com/users/kunzai/orgs","repos_url":"https://api.github.com/users/kunzai/repos","events_url":"https://api.github.com/users/kunzai/events{/privacy}","received_events_url":"https://api.github.com/users/kunzai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-29T15:16:43Z","updated_at":"2016-01-29T15:16:43Z","closed_at":null,"body":"Hi\r\n\r\nI`m trying to access a function from a resolve, configured in ui-router.\r\nWhen \"resolved\", the dataservice is \"undefined\" in dataPrepService. I`m not sure if this is due to a misconfiguration of mine or a problem of the config of router.\r\n\r\nThe code I`m using:\r\n\r\ndashboard.route.js:\r\n`(function () {\r\n   \"use strict\";\r\n\r\n    angular\r\n        .module('app.dashboard')\r\n        .run(appRun);\r\n\r\n    appRun.$inject = ['routerHelper', \"dataservice\"];\r\n    /* @ngInject */\r\n    function appRun(routerHelper, dataservice) {\r\n        routerHelper.configureStates(getStates());\r\n    }\r\n\r\n    function getStates() {\r\n        return [{\r\n            state: 'app',\r\n            config: {\r\n                resolve: {\r\n                    dataPrepService: dataPrepService\r\n                },\r\n                url: '/',\r\n                views: {\r\n                    \"header\": {\r\n                        templateUrl: \"app/layout/header.html\"\r\n                    },\r\n                    \"sidebar\": {\r\n                        templateUrl: \"app/layout/sidebar.html\",\r\n                        controller: \"CountriesController\",\r\n                        controllerAs: \"vm\",\r\n                    },\r\n                    //more views\r\n                }\r\n            }\r\n\r\n        }];\r\n    }\r\n\r\n    dataPrepService.$inject = [\"dataservice\"];\r\n    function dataPrepService(dataservice) {\r\n        return dataservice.retrieveData();\r\n    }\r\n\r\n})();\r\n`\r\ncountries.controller.js\r\n`\r\n(function () {\r\n    'use strict';\r\n\r\n    angular\r\n        .module('app.layout')\r\n        .controller('CountriesController', CountriesController);\r\n\r\n    CountriesController.$inject = [\"$scope\", \"$state\", \"logger\", \"$translate\", \"serv\", \"dataservice\", \"pageservice\"];\r\n\r\n    /* @ngInject */\r\n    function CountriesController($scope, $state, logger, $translate, serv, dataservice, pageservice) {\r\n        /* jshint validthis: true */\r\n        var vm = this;\r\n        activate();\r\n\r\n        function activate() {\r\n            $state.$current.resolve.dataPrepService().then(function () {\r\n            // compute the data....\r\n\r\n            });\r\n        }\r\n`\r\n\r\nIf more information is needed, I`m happy to provide those.\r\n\r\nThanks in advance.\r\n"}}