{"action":"opened","number":10725,"pull_request":{"url":"https://api.github.com/repos/angular/angular.js/pulls/10725","id":27194133,"html_url":"https://github.com/angular/angular.js/pull/10725","diff_url":"https://github.com/angular/angular.js/pull/10725.diff","patch_url":"https://github.com/angular/angular.js/pull/10725.patch","issue_url":"https://api.github.com/repos/angular/angular.js/issues/10725","number":10725,"state":"open","locked":false,"title":"Assign fn.$inject during annotation from array","user":{"login":"litera","id":800583,"avatar_url":"https://avatars.githubusercontent.com/u/800583?v=3","gravatar_id":"","url":"https://api.github.com/users/litera","html_url":"https://github.com/litera","followers_url":"https://api.github.com/users/litera/followers","following_url":"https://api.github.com/users/litera/following{/other_user}","gists_url":"https://api.github.com/users/litera/gists{/gist_id}","starred_url":"https://api.github.com/users/litera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/litera/subscriptions","organizations_url":"https://api.github.com/users/litera/orgs","repos_url":"https://api.github.com/users/litera/repos","events_url":"https://api.github.com/users/litera/events{/privacy}","received_events_url":"https://api.github.com/users/litera/received_events","type":"User","site_admin":false},"body":"When Angular annotates straight from function it adds `$inject` *static* field to function itself. But when Angular annotates a function from an array it subsequently doesn't add the same. It would be advantageous if it did the same as client code may also use this field's value.\r\n\r\nUsage example\r\n--\r\nI'm following John Papa's angular guidelines how to write better maintainable angular code. So I'm writing my controllers/services using actual prototypes (that's even better than containing all behaviour within controller's scope as John Papa does). To actually work with prototypes we need all constructor injections on instantiated object so they can be accessed from other prototype functions. But to avoid adding these manually one can write a function i.e. `injectParameters` that does it automatically. This specific function reads those either from `$inject` static field or it parses function similar as angular's annotation does. The problem happens with minified files where argument names may be different from the actual ones provided in original code. The same problem happens in Angular hence two possible injection scenarios. So because Angular annotation doesn't add the `$inject` field when some controller/service was provided using an array there is no possibility to get those names correctly.\r\n\r\n```Javascript\r\nfunction MyController($scope, someResource...) {\r\n    injectParameters(this, arguments); // will make all injections accessible under this.injections...\r\n    ...\r\n}\r\n\r\nMyController.prototype.doSomething() {\r\n    // use injections\r\n    this.injections.someResource.get(...);\r\n}","created_at":"2015-01-12T13:37:14Z","updated_at":"2015-01-12T13:37:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27011ddf1bb175a6e3951a2a45cfbc389b50cdbb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/angular/angular.js/pulls/10725/commits","review_comments_url":"https://api.github.com/repos/angular/angular.js/pulls/10725/comments","review_comment_url":"https://api.github.com/repos/angular/angular.js/pulls/comments/{number}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/10725/comments","statuses_url":"https://api.github.com/repos/angular/angular.js/statuses/637d4e33a0ed0a5825ea95cc62c8ee74fb71548b","head":{"label":"litera:patch-1","ref":"patch-1","sha":"637d4e33a0ed0a5825ea95cc62c8ee74fb71548b","user":{"login":"litera","id":800583,"avatar_url":"https://avatars.githubusercontent.com/u/800583?v=3","gravatar_id":"","url":"https://api.github.com/users/litera","html_url":"https://github.com/litera","followers_url":"https://api.github.com/users/litera/followers","following_url":"https://api.github.com/users/litera/following{/other_user}","gists_url":"https://api.github.com/users/litera/gists{/gist_id}","starred_url":"https://api.github.com/users/litera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/litera/subscriptions","organizations_url":"https://api.github.com/users/litera/orgs","repos_url":"https://api.github.com/users/litera/repos","events_url":"https://api.github.com/users/litera/events{/privacy}","received_events_url":"https://api.github.com/users/litera/received_events","type":"User","site_admin":false},"repo":{"id":16124657,"name":"angular.js","full_name":"litera/angular.js","owner":{"login":"litera","id":800583,"avatar_url":"https://avatars.githubusercontent.com/u/800583?v=3","gravatar_id":"","url":"https://api.github.com/users/litera","html_url":"https://github.com/litera","followers_url":"https://api.github.com/users/litera/followers","following_url":"https://api.github.com/users/litera/following{/other_user}","gists_url":"https://api.github.com/users/litera/gists{/gist_id}","starred_url":"https://api.github.com/users/litera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/litera/subscriptions","organizations_url":"https://api.github.com/users/litera/orgs","repos_url":"https://api.github.com/users/litera/repos","events_url":"https://api.github.com/users/litera/events{/privacy}","received_events_url":"https://api.github.com/users/litera/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/litera/angular.js","description":"","fork":true,"url":"https://api.github.com/repos/litera/angular.js","forks_url":"https://api.github.com/repos/litera/angular.js/forks","keys_url":"https://api.github.com/repos/litera/angular.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/litera/angular.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/litera/angular.js/teams","hooks_url":"https://api.github.com/repos/litera/angular.js/hooks","issue_events_url":"https://api.github.com/repos/litera/angular.js/issues/events{/number}","events_url":"https://api.github.com/repos/litera/angular.js/events","assignees_url":"https://api.github.com/repos/litera/angular.js/assignees{/user}","branches_url":"https://api.github.com/repos/litera/angular.js/branches{/branch}","tags_url":"https://api.github.com/repos/litera/angular.js/tags","blobs_url":"https://api.github.com/repos/litera/angular.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/litera/angular.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/litera/angular.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/litera/angular.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/litera/angular.js/statuses/{sha}","languages_url":"https://api.github.com/repos/litera/angular.js/languages","stargazers_url":"https://api.github.com/repos/litera/angular.js/stargazers","contributors_url":"https://api.github.com/repos/litera/angular.js/contributors","subscribers_url":"https://api.github.com/repos/litera/angular.js/subscribers","subscription_url":"https://api.github.com/repos/litera/angular.js/subscription","commits_url":"https://api.github.com/repos/litera/angular.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/litera/angular.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/litera/angular.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/litera/angular.js/issues/comments/{number}","contents_url":"https://api.github.com/repos/litera/angular.js/contents/{+path}","compare_url":"https://api.github.com/repos/litera/angular.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/litera/angular.js/merges","archive_url":"https://api.github.com/repos/litera/angular.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/litera/angular.js/downloads","issues_url":"https://api.github.com/repos/litera/angular.js/issues{/number}","pulls_url":"https://api.github.com/repos/litera/angular.js/pulls{/number}","milestones_url":"https://api.github.com/repos/litera/angular.js/milestones{/number}","notifications_url":"https://api.github.com/repos/litera/angular.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/litera/angular.js/labels{/name}","releases_url":"https://api.github.com/repos/litera/angular.js/releases{/id}","created_at":"2014-01-22T01:20:26Z","updated_at":"2014-01-22T01:48:57Z","pushed_at":"2015-01-12T13:24:42Z","git_url":"git://github.com/litera/angular.js.git","ssh_url":"git@github.com:litera/angular.js.git","clone_url":"https://github.com/litera/angular.js.git","svn_url":"https://github.com/litera/angular.js","homepage":"http://angularjs.org","size":48992,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"5a60302389162c6ef45f311c1aaa65a00d538c66","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":460078,"name":"angular.js","full_name":"angular/angular.js","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/angular.js","description":"HTML enhanced for web apps","fork":false,"url":"https://api.github.com/repos/angular/angular.js","forks_url":"https://api.github.com/repos/angular/angular.js/forks","keys_url":"https://api.github.com/repos/angular/angular.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular.js/teams","hooks_url":"https://api.github.com/repos/angular/angular.js/hooks","issue_events_url":"https://api.github.com/repos/angular/angular.js/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular.js/events","assignees_url":"https://api.github.com/repos/angular/angular.js/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular.js/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular.js/tags","blobs_url":"https://api.github.com/repos/angular/angular.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular.js/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular.js/languages","stargazers_url":"https://api.github.com/repos/angular/angular.js/stargazers","contributors_url":"https://api.github.com/repos/angular/angular.js/contributors","subscribers_url":"https://api.github.com/repos/angular/angular.js/subscribers","subscription_url":"https://api.github.com/repos/angular/angular.js/subscription","commits_url":"https://api.github.com/repos/angular/angular.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular.js/issues/comments/{number}","contents_url":"https://api.github.com/repos/angular/angular.js/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular.js/merges","archive_url":"https://api.github.com/repos/angular/angular.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular.js/downloads","issues_url":"https://api.github.com/repos/angular/angular.js/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular.js/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular.js/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular.js/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular.js/releases{/id}","created_at":"2010-01-06T00:34:37Z","updated_at":"2015-01-12T13:24:52Z","pushed_at":"2015-01-12T12:11:28Z","git_url":"git://github.com/angular/angular.js.git","ssh_url":"git@github.com:angular/angular.js.git","clone_url":"https://github.com/angular/angular.js.git","svn_url":"https://github.com/angular/angular.js","homepage":"http://angularjs.org","size":206005,"stargazers_count":33945,"watchers_count":33945,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13474,"mirror_url":null,"open_issues_count":1134,"forks":13474,"open_issues":1134,"watchers":33945,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular.js/pulls/10725"},"html":{"href":"https://github.com/angular/angular.js/pull/10725"},"issue":{"href":"https://api.github.com/repos/angular/angular.js/issues/10725"},"comments":{"href":"https://api.github.com/repos/angular/angular.js/issues/10725/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular.js/pulls/10725/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular.js/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/angular/angular.js/pulls/10725/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular.js/statuses/637d4e33a0ed0a5825ea95cc62c8ee74fb71548b"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":1,"deletions":0,"changed_files":1}}