This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
$componentController doesn't bind properties when component uses ES6 controller class #14437
Milestone
Comments
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Apr 14, 2016
…trollers (e.g. class-based) The decorated version of `$controller` is able to assign bindings to a controller instance prior to instantiation, emulating the behavior of `$compile` with directive controllers. There are cases, that the actual controller instance is different than the pre-populated one (e.g. when the controller constructor function returns a value or when the controller is an ES2015 Class). While `$compile` accounts for such situation, by re-asigning the bindings after the controller has been instantiated, `ngMock`'s `$controller` didn't. This commit fixes it, by re-applying the bindings if the actual controller instance is different than the original one (similar to how `$compile` would do it). Fixes angular#14437
3 tasks
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Apr 14, 2016
…trollers (e.g. class-based) The decorated version of `$controller` is able to assign bindings to a controller instance prior to instantiation, emulating the behavior of `$compile` with directive controllers. There are cases, that the actual controller instance is different than the pre-populated one (e.g. when the controller constructor function returns a value or when the controller is an ES2015 Class). While `$compile` accounts for such situation, by re-asigning the bindings after the controller has been instantiated, `ngMock`'s `$controller` didn't. This commit fixes it, by re-applying the bindings if the actual controller instance is different than the original one (similar to how `$compile` would do it). Fixes angular#14437
gkalpak
added a commit
to gkalpak/angular.js
that referenced
this issue
Apr 15, 2016
…trollers (e.g. class-based) The decorated version of `$controller` is able to assign bindings to a controller instance prior to instantiation, emulating the behavior of `$compile` with directive controllers. There are cases, that the actual controller instance is different than the pre-populated one (e.g. when the controller constructor function returns a value or when the controller is an ES2015 Class). While `$compile` accounts for such situation, by re-asigning the bindings after the controller has been instantiated, `ngMock`'s `$controller` didn't. This commit fixes it, by re-applying the bindings if the actual controller instance is different than the original one (similar to how `$compile` would do it). Fixes angular#14437
gkalpak
added a commit
that referenced
this issue
Jun 7, 2016
…trollers (e.g. class-based) The decorated version of `$controller` is able to assign bindings to a controller instance prior to instantiation, emulating the behavior of `$compile` with directive controllers. There are cases, that the actual controller instance is different than the pre-populated one (e.g. when the controller constructor function returns a value or when the controller is an ES2015 Class). While `$compile` accounts for such situation, by re-asigning the bindings after the controller has been instantiated, `ngMock`'s `$controller` didn't. This commit fixes it, by re-applying the bindings if the actual controller instance is different than the original one (similar to how `$compile` would do it). Fixes #14437 Closes #14439
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Bindings set up with $componentController are undefined when using a ES6 class as the controller. See an example at http://jsbin.com/qaxivowuni/1/edit?js,output. Switching from the Es6Controller to the Es5Controller causes the binding to be defined.
What is the expected behavior?
The bindings are defined regardless of how the controller class is created.
What is the motivation / use case for changing the behavior?
Unable to use ES6 features.
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Angular 1.5 / Chrome 49.0.2623.87 / Mac OS 10.11.4
The text was updated successfully, but these errors were encountered: