Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Possible bug: Optional binding =? not required anymore in 1.4 where it is in 1.3 #13367

Closed
cburgdorf opened this issue Nov 24, 2015 · 5 comments

Comments

@cburgdorf
Copy link
Contributor

This is a follow up to #9216 (comment)

I noticed that there is a breaking change regarding =? between 1.3 and 1.4.

This example throws with an exception when you try to toggle the second zippy because it doesn't use the open binding and the binding isn't marked as optional. The example is based on 1.3.

http://plnkr.co/edit/Ef2iKOde3TmGzJHRGEhE?p=preview

The same example using 1.4 does not throw however.

http://plnkr.co/edit/cWxO6shBz7OaiewCDMHp?p=preview

@petebacondarwin
Copy link
Contributor

It seems that if the value is non-assignable we now never call the watch handler for setting the parent value.

We are still creating the correct parentSet function, at https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L2754, which will throw the exception.

And we are still creating the watches correctly at https://github.com/angular/angular.js/blob/master/src/ng/compile.js#L2780

But for some reason the handler never gets fired by the digest. I think this could be some optimisation that sees that the values are never going to change and so doesn't bother watching?

@petebacondarwin
Copy link
Contributor

It appears between 1.4.0-beta.2 and 1.4.0-beta.3

@petebacondarwin
Copy link
Contributor

git bisect tells us that this bug did indeed appear in 6a38dbf

@cburgdorf
Copy link
Contributor Author

I wonder if that's really a bug or a feature? The question would be if there are any downsides of the behavior because for this example it turns out as something positive. It makes the example work out of the box without having to know about optional bindings.

@lgalfaso
Copy link
Contributor

I think this is an oversight on the PR that @petebacondarwin pointed out.

lgalfaso added a commit to lgalfaso/angular.js that referenced this issue Nov 24, 2015
When calling `$parse` with `undefined` as the expression and with
an interceptor, then when the function is evaluated, then call the
interceptor

Closes: angular#13367
lgalfaso added a commit that referenced this issue Nov 25, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
When calling `$parse` with `undefined` as the expression and with
an interceptor, then when the function is evaluated, then call the
interceptor

Closes: #13367
Closes: #13373
petebacondarwin added a commit that referenced this issue Nov 25, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Demonstrates that #13373 fixes #13367
petebacondarwin added a commit that referenced this issue Nov 25, 2015

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Demonstrates that #13373 fixes #13367
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants