{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14134","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14134/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14134/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14134/events","html_url":"https://github.com/angular/angular.js/issues/14134","id":136693396,"number":14134,"title":"$resolve is not added to the $scope until after the controller is instantiated","user":{"login":"jdforsythe","id":286972,"avatar_url":"https://avatars.githubusercontent.com/u/286972?v=3","gravatar_id":"","url":"https://api.github.com/users/jdforsythe","html_url":"https://github.com/jdforsythe","followers_url":"https://api.github.com/users/jdforsythe/followers","following_url":"https://api.github.com/users/jdforsythe/following{/other_user}","gists_url":"https://api.github.com/users/jdforsythe/gists{/gist_id}","starred_url":"https://api.github.com/users/jdforsythe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdforsythe/subscriptions","organizations_url":"https://api.github.com/users/jdforsythe/orgs","repos_url":"https://api.github.com/users/jdforsythe/repos","events_url":"https://api.github.com/users/jdforsythe/events{/privacy}","received_events_url":"https://api.github.com/users/jdforsythe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20ngRoute","name":"component: ngRoute","color":"DDDDDD"},{"url":"https://api.github.com/repos/angular/angular.js/labels/frequency:%20low","name":"frequency: low","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular.js/labels/severity:%20inconvenient","name":"severity: inconvenient","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/38","html_url":"https://github.com/angular/angular.js/milestones/Ice%20Box","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/38/labels","id":529901,"number":38,"title":"Ice Box","description":"Milestone for valid issues and bugs that we have no aspirations on fixing any time soon because they are not affecting primary use-cases and are not aligned with our goals.","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":204,"closed_issues":212,"state":"open","created_at":"2014-01-08T08:19:21Z","updated_at":"2016-02-27T13:23:54Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-02-26T13:11:54Z","updated_at":"2016-02-27T15:03:17Z","closed_at":null,"body":"**Note: for support questions, please use one of these channels:** https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.\r\n\r\n* **Do you want to request a *feature* or report a *bug*?**\r\nBUG\r\n\r\n\r\n* **What is the current behavior?**\r\nSee my question and the accepted answer at http://stackoverflow.com/questions/35637853/access-angular-route-scope-property-resolve-within-controller-instead-of-view/35647226#35647226\r\n\r\nThe new $resolve property on the scope added in #134400 works fine when referenced from within the view template. However, the property is not available on `$scope` within a controller unless a `$timeout` is used. Additionally, even using `$timeout` (maybe as a result of using `controllerAs` syntax?) the value can be printed to the console but still does not propagate to the view.\r\n\r\n\r\n* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem**\r\nhttps://jsfiddle.net/96dwgjea/1/\r\n\r\n\r\n* **What is the expected behavior?**\r\nThe `$resolve` property should be put on the scope prior to the controller being instantiated.\r\n\r\nIt would be even better if `$resolve` was available to inject directly into the controller, so using the `controllerAs` syntax I could just do:\r\n\r\n    app.config(function($routeProvider) {\r\n      $routeProvider.when('/test'. {\r\n        templateUrl: 'test.html',\r\n        controller: 'TestController',\r\n        controllerAs: 'vm',\r\n        resolve: {\r\n          'stuff': function() { return 'stuff'; },\r\n          'otherstuff': function() { return 'other stuff'; }\r\n        }\r\n      });\r\n    });\r\n\r\n    app.controller(function($resolve) {\r\n      this.stuff = $resolve.stuff;\r\n      this.otherstuff = $resolve.otherstuff;\r\n    });\r\n\r\nInstead of injecting the whole `$scope`:\r\n\r\n    app.controller(function($scope) {\r\n      this.stuff = $scope.$resolve.stuff;\r\n      this.otherstuff = $scope.$resolve.otherstuff;\r\n    });\r\n\r\n\r\n* **What is the motivation / use case for changing the behavior?**\r\nMany times I need/want to make mutated copies of the resolved properties for use in the view while still retaining the full data set in the controller. I can easily do this the old way, by injecting each individual resolve property, but I have controllers that have a lot of parameters due to having a bunch of resolve properties (think a view with a form containing a bunch of `<select>`s populated with arrays obtained from factories). It would be much cleaner if all of these properties were injectable in one parameter rather than n parameters.\r\n\r\n\r\n* **Which version of Angular, and which browser and OS does this issue affect?**\r\n1.5.0 - tested on Chrome 48.0.2564.116 m\r\n\r\n\r\n\r\n* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix)\r\nI will submit a PR to fix the issue of needing the `$timeout`. The issue of having `$resolve` as an injectable would obviously need further discussion."},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/189658552","html_url":"https://github.com/angular/angular.js/issues/14134#issuecomment-189658552","issue_url":"https://api.github.com/repos/angular/angular.js/issues/14134","id":189658552,"user":{"login":"Narretz","id":1153097,"avatar_url":"https://avatars.githubusercontent.com/u/1153097?v=3","gravatar_id":"","url":"https://api.github.com/users/Narretz","html_url":"https://github.com/Narretz","followers_url":"https://api.github.com/users/Narretz/followers","following_url":"https://api.github.com/users/Narretz/following{/other_user}","gists_url":"https://api.github.com/users/Narretz/gists{/gist_id}","starred_url":"https://api.github.com/users/Narretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Narretz/subscriptions","organizations_url":"https://api.github.com/users/Narretz/orgs","repos_url":"https://api.github.com/users/Narretz/repos","events_url":"https://api.github.com/users/Narretz/events{/privacy}","received_events_url":"https://api.github.com/users/Narretz/received_events","type":"User","site_admin":false},"created_at":"2016-02-27T15:03:17Z","updated_at":"2016-02-27T15:03:17Z","body":"Yes I meanthttps://github.com/angular/angular.js/issues/13844"}}