{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/13510","labels_url":"https://api.github.com/repos/angular/angular.js/issues/13510/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/13510/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/13510/events","html_url":"https://github.com/angular/angular.js/issues/13510","id":121672931,"number":13510,"title":"fix($controller): support instantiation of ES6 classes","user":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/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/needs:%20investigation","name":"needs: investigation","color":"444444"},{"url":"https://api.github.com/repos/angular/angular.js/labels/severity:%20broken%20expected%20use","name":"severity: broken expected use","color":"fbda00"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20bug","name":"type: bug","color":"000000"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/112","html_url":"https://github.com/angular/angular.js/milestones/1.5.0-rc.1","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/112/labels","id":1451924,"number":112,"title":"1.5.0-rc.1","description":"","creator":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":4,"state":"open","created_at":"2015-12-09T14:08:59Z","updated_at":"2015-12-15T13:47:00Z","due_on":"2015-12-16T00:00:00Z","closed_at":null},"comments":7,"created_at":"2015-12-11T09:44:49Z","updated_at":"2015-12-15T14:00:16Z","closed_at":null,"body":"See https://github.com/angular/angular.js/pull/12598#issuecomment-163738832\r\n\r\nThe `$controller` service has two paths for creating instances of a controller. In the `later == true` path we are not using `$injector.instantiate`, which has recently been fixed to support ES6 classes.\r\n\r\nWe ought to refactor `$controller` to use `$injector.instantiate` in both paths for consistency, if this is possible."},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/164773325","html_url":"https://github.com/angular/angular.js/issues/13510#issuecomment-164773325","issue_url":"https://api.github.com/repos/angular/angular.js/issues/13510","id":164773325,"user":{"login":"thorn0","id":94334,"avatar_url":"https://avatars.githubusercontent.com/u/94334?v=3","gravatar_id":"","url":"https://api.github.com/users/thorn0","html_url":"https://github.com/thorn0","followers_url":"https://api.github.com/users/thorn0/followers","following_url":"https://api.github.com/users/thorn0/following{/other_user}","gists_url":"https://api.github.com/users/thorn0/gists{/gist_id}","starred_url":"https://api.github.com/users/thorn0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorn0/subscriptions","organizations_url":"https://api.github.com/users/thorn0/orgs","repos_url":"https://api.github.com/users/thorn0/repos","events_url":"https://api.github.com/users/thorn0/events{/privacy}","received_events_url":"https://api.github.com/users/thorn0/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T14:00:16Z","updated_at":"2015-12-15T14:00:16Z","body":"This works:\r\n```js\r\nclass Controller { \r\n  constructor(x) {\r\n    console.log(this.bindingValue);\r\n    this.x = x;\r\n  }\r\n}\r\n\r\nvar disposableSubclass = class DisposableSubclass extends Controller {};\r\nvar self = disposableSubclass.prototype;\r\n\r\n// add bindings\r\nself.bindingValue = 100;\r\n\r\n// this.bindingValue is available in the Controller's constructor now\r\nvar instance = new (Function.bind.apply(disposableSubclass, [null, 2]));\r\n```"}}