{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/10347","labels_url":"https://api.github.com/repos/angular/angular.js/issues/10347/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/10347/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/10347/events","html_url":"https://github.com/angular/angular.js/issues/10347","id":51144629,"number":10347,"title":"di: Allow arbitrary objects as identifiers for services","user":{"login":"ewinslow","id":356564,"avatar_url":"https://avatars.githubusercontent.com/u/356564?v=3","gravatar_id":"","url":"https://api.github.com/users/ewinslow","html_url":"https://github.com/ewinslow","followers_url":"https://api.github.com/users/ewinslow/followers","following_url":"https://api.github.com/users/ewinslow/following{/other_user}","gists_url":"https://api.github.com/users/ewinslow/gists{/gist_id}","starred_url":"https://api.github.com/users/ewinslow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewinslow/subscriptions","organizations_url":"https://api.github.com/users/ewinslow/orgs","repos_url":"https://api.github.com/users/ewinslow/repos","events_url":"https://api.github.com/users/ewinslow/events{/privacy}","received_events_url":"https://api.github.com/users/ewinslow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/branch:%201.5.x","name":"branch: 1.5.x","color":"207de5"},{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20di","name":"component: di","color":"d4c5f9"},{"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/type:%20feature","name":"type: feature","color":"00a606"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/27","html_url":"https://github.com/angular/angular.js/milestones/Backlog","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/27/labels","id":489171,"number":27,"title":"Backlog","description":"Holds the backlog of issues and pull requests that have been triaged.\r\n\r\nBefore assigning items to this milestone they should be labelled, at the very least with the correct \"type\" label (i.e. \"issue\", \"pr\", \"bug\", \"regression\", \"chore\", \"docs\", etc).  Preferably you should also check for duplicate issues/PRs, note CLA status and assign \"complexity\" and \"impact\" labels too.","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":678,"closed_issues":1005,"state":"open","created_at":"2013-11-18T23:30:35Z","updated_at":"2015-10-15T11:49:33Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2014-12-05T20:52:14Z","updated_at":"2015-10-15T11:51:09Z","closed_at":null,"body":"This could help us (start to) break away from the string-only ids for services in 1.x, without waiting for 2.0.\r\n\r\nExample declaring an injection point\r\n```js\r\nFoo.$inject = [Storage]; // instead of Foo.$inject = ['db'];\r\nfunction Foo(db) {\r\n ... \r\n}\r\n```\r\n\r\nExample wiring up the implementation in an angular module:\r\n\r\n```js\r\n// These are all meant to be equivalent\r\nangular.module('foo', [])\r\n  .value(Storage, new StorageImpl())\r\n  .service(Storage, StorageImpl)\r\n  .factory(Storage, function() { return new StorageImpl() })\r\n  .provider(Storage, function() { this.$get = function() { return new StorageImpl() }; });\r\n```\r\n\r\nI am able to implement this in a library where I generate the string IDs for compatibility with Angular 1.3, but it feels pretty hacky and seems like something Angular core should take care of. \r\n\r\nFor reference, it ends up looking something like this:\r\n\r\n```js\r\nFoo.$inject = inject(Storage, Other...);\r\nfunction Foo(storage, other) {...}\r\n\r\nangular.module('foo', [])\r\n  .service(id(Storage), StorageImpl);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/148364644","html_url":"https://github.com/angular/angular.js/issues/10347#issuecomment-148364644","issue_url":"https://api.github.com/repos/angular/angular.js/issues/10347","id":148364644,"user":{"login":"mikehaas763","id":2096573,"avatar_url":"https://avatars.githubusercontent.com/u/2096573?v=3","gravatar_id":"","url":"https://api.github.com/users/mikehaas763","html_url":"https://github.com/mikehaas763","followers_url":"https://api.github.com/users/mikehaas763/followers","following_url":"https://api.github.com/users/mikehaas763/following{/other_user}","gists_url":"https://api.github.com/users/mikehaas763/gists{/gist_id}","starred_url":"https://api.github.com/users/mikehaas763/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikehaas763/subscriptions","organizations_url":"https://api.github.com/users/mikehaas763/orgs","repos_url":"https://api.github.com/users/mikehaas763/repos","events_url":"https://api.github.com/users/mikehaas763/events{/privacy}","received_events_url":"https://api.github.com/users/mikehaas763/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T11:51:08Z","updated_at":"2015-10-15T11:51:08Z","body":"+1"}}