-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($compile): add preAssignBindings
flag
#15095
feat($compile): add preAssignBindings
flag
#15095
Conversation
In line with a few other provider fns, I think we should call this one |
I can't comment on |
@Narretz - I agree. I will update the name of the flag getter-setter @mgol - Github will show the diff if you ignore whitespare: https://github.com/angular/angular.js/pull/15095/files?w=s. In the tests I took the approach of running a large collection of the tests with both This covers almost all the changes in the specs, except for the one that you point out |
@petebd I know about the w URL param but GitHub doesn't let one comment on Michał Gołębiowski |
@mgol - true, true |
@petebacondarwin I realize why you changed the logic to conditionally run the check in $compileProvider.preAssignBindings(preAssignBindings); into: $compileProvider.preAssignBindings(true); all the tests still pass and they shouldn't. |
Ah right! OK, I'll add an extra test that actually checks the difference |
Fixed up via 4f599ff PTAL |
I think it is actually a bug (depends on your POV). We fail to detect Minor: Probably also the case for some other similar helpers, but there are no tests for the getter nature of Other than that LGTM 👍 |
Actually that is not exactly true. We are not reporting it constantly as changed, but we do report it one extra time (something that doesn't happen with non-NaN values). In any case, it is not related to this PR. I would change the test to not be affected by this edge case. |
I submitted a fix for this in #15098 😄 |
A new flag to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580
4f599ff
to
1a06ea7
Compare
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See #14580 Closes #15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580 Closes angular#15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580 Closes angular#15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580 Closes angular#15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580 Closes angular#15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See angular#14580 Closes angular#15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See #14580 Closes #15095
A new option to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor. If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called. If disabled (false), the compiler calls the constructor first before assigning bindings. The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x. See #14580 Closes #15095
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feature
What is the current behavior? (You can also link to an open issue here)
Bindings are assigned to controller objects before their constructors are called
What is the new behavior (if this is a feature change)?
A flag can now be set so that bindings are assigned to controller objects after their constructors are called
Does this PR introduce a breaking change?
no
Please check if the PR fulfills these requirements
Other information:
A new flag to enable/disable whether directive controllers are assigned bindings before
calling the controller's constructor.
If enabled (true), the compiler assigns the value of each of the bindings to the
properties of the controller object before the constructor of this object is called.
If disabled (false), the compiler calls the constructor first before assigning bindings.
The default value is enabled (true) in Angular 1.5.x but will switch to false in Angular 1.6.x.
See #14580