-
Notifications
You must be signed in to change notification settings - Fork 27.5k
feat($compile): Allow ES6 classes as controllers with bindToController: true #13540
Conversation
7562677
to
6dd8f17
Compare
…er: true` Modify `$injector.invoke` so ES6 classes would be invoked using `new` Closes: angular#13510 Closes: angular#13540
6dd8f17
to
031f3f2
Compare
Do not know how to fix this flake in the tests
|
}, | ||
controller: eval( | ||
"class Foo {" + | ||
" constructor($scope) {}" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is $scope
needed here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, will remove it
LGTM Something for a follow-up PR: |
@petebacondarwin do you think this should go into 1.5 ? |
@lgalfaso There's a significant problem with this approach, I've covered it in this comment and fought it in that extension (you may go by the implementation and see how clumsy it became with multiple checks and flags). The source of the problem is that this
will work for native classes and will fail for transpiled ones (with Babel). |
I am landing this as this PR already has enough to handle all current browsers that natively support |
@bisubus I am not sure how this affects Babel at all. The current mechanism that forces a |
…er: true` Modify `$injector.invoke` so ES6 classes would be invoked using `new` Closes: angular#13510 Closes: angular#13540 (reverted from commit b0248b7)
This change caused IE9 to run out of memory. |
…er: true` Modify `$injector.invoke` so ES6 classes would be invoked using `new` Closes: angular#13510 Closes: angular#13540
Modify
$injector.invoke
so ES6 classes would be invoked usingnew
Closes: #13510