{"action":"created","issue":{"url":"https://api.github.com/repos/CaryLandholt/ng-classify/issues/34","labels_url":"https://api.github.com/repos/CaryLandholt/ng-classify/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/CaryLandholt/ng-classify/issues/34/comments","events_url":"https://api.github.com/repos/CaryLandholt/ng-classify/issues/34/events","html_url":"https://github.com/CaryLandholt/ng-classify/issues/34","id":63902351,"number":34,"title":"Resolve dependency injection","user":{"login":"nahue","id":96837,"avatar_url":"https://avatars.githubusercontent.com/u/96837?v=3","gravatar_id":"","url":"https://api.github.com/users/nahue","html_url":"https://github.com/nahue","followers_url":"https://api.github.com/users/nahue/followers","following_url":"https://api.github.com/users/nahue/following{/other_user}","gists_url":"https://api.github.com/users/nahue/gists{/gist_id}","starred_url":"https://api.github.com/users/nahue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nahue/subscriptions","organizations_url":"https://api.github.com/users/nahue/orgs","repos_url":"https://api.github.com/users/nahue/repos","events_url":"https://api.github.com/users/nahue/events{/privacy}","received_events_url":"https://api.github.com/users/nahue/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-24T04:45:18Z","updated_at":"2015-03-26T18:37:43Z","closed_at":null,"body":"When using resolve for ex with the \"messages\" var.. throws DI error.. because its loaded in the array as a dependency.. but its not.\r\n\r\nIs there a way of avoiding this?\r\nThanks!\r\n\r\n\r\nex:\r\n\r\nresolve:\r\n   lives: (LiveService) ->\r\n      LiveService.getAll()\r\n\r\nclass Home extends Controller\r\n    constructor: ($scope, $state, Faye, authenticationService, lives)\r\n\r\nturns into\r\n\r\n['$scope', '$state', 'Faye', 'authenticationService', 'lives' ...]"},"comment":{"url":"https://api.github.com/repos/CaryLandholt/ng-classify/issues/comments/86661943","html_url":"https://github.com/CaryLandholt/ng-classify/issues/34#issuecomment-86661943","issue_url":"https://api.github.com/repos/CaryLandholt/ng-classify/issues/34","id":86661943,"user":{"login":"nahue","id":96837,"avatar_url":"https://avatars.githubusercontent.com/u/96837?v=3","gravatar_id":"","url":"https://api.github.com/users/nahue","html_url":"https://github.com/nahue","followers_url":"https://api.github.com/users/nahue/followers","following_url":"https://api.github.com/users/nahue/following{/other_user}","gists_url":"https://api.github.com/users/nahue/gists{/gist_id}","starred_url":"https://api.github.com/users/nahue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nahue/subscriptions","organizations_url":"https://api.github.com/users/nahue/orgs","repos_url":"https://api.github.com/users/nahue/repos","events_url":"https://api.github.com/users/nahue/events{/privacy}","received_events_url":"https://api.github.com/users/nahue/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T18:37:42Z","updated_at":"2015-03-26T18:37:42Z","body":"Thank you very much! i will try this later, if it works.. can i have your\npermission to make a blog post? im still building my personal blog.\n\nGreets!\n\n2015-03-26 0:12 GMT-03:00 Cary Landholt <notifications@github.com>:\n\n> Try using a factory to represent the lives resolve function. *see below*\n> The Resolver factory takes in the liveService and returns all of the lives\n> .\n> The resolve.lives config takes in the Resolver factory and executes it.\n> The results will be assigned to the homeController's last parameter as\n> lives.\n>\n> class Resolver extends Factory\n>   constructor: (liveService) ->\n>     return liveService.getAll()\n> class Routes extends Config\n>   constructor: ($routeProvider) ->\n>     $routeProvider.when '/home',\n>       templateUrl: 'template.html'\n>       controller: 'homeController'\n>       resolve:\n>         lives: ['Resolver', (resolve) -> resolve()]\n> class Home extends Controller\n>   constructor: ($scope, $state, Faye, authenticationService, lives) ->\n>     # other code\n>\n> which is equivalent to:\n>\n> class Resolver\n>   constructor: (liveService) ->\n>     return liveService.getAll()\n> class Routes\n>   constructor: ($routeProvider) ->\n>     $routeProvider.when '/home',\n>       templateUrl: 'template.html'\n>       controller: 'homeController'\n>       resolve:\n>         lives: ['Resolver', (resolve) -> resolve()]\n> class Home\n>   constructor: ($scope, $state, Faye, authenticationService, lives) ->\n>     # other code\n>\n> angular.module('app')\n> .factory('Resolver', ['liveService', Resolver])\n> .config(['$routeProvider', Routes])\n> .controller('homeController', ['$scope', '$state', 'Faye', 'authenticationService', 'lives', Home])\n>\n> Please let me know if this helps. I follow this pattern myself.\n>\n> Thanks,\n> Cary\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/CaryLandholt/ng-classify/issues/34#issuecomment-86319915>\n> .\n>\n"}}