Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
fix($compile): do not initialize optional '&' binding if attribute not specified #9216
Also, do not set up an expression in scope if the '&' binding is optional.
Previously, '&' expressions would always set up a function in the isolate
Finally, if the '&' expression is not optional, and the attribute is not
So, the error content isn't very good, I'm not sure what else to add to it really.
I feel like this will surprise people, which isn't very nice :( Also it's another breaking change, so we probably can't really get this into 1.3.
However it has been asked for, and it probably is the expected behaviour.
/cc @IgorMinar can you take a look and decide if we want to do this or not?
it's too late for this change to get into 1.3.
making this an opt-in is not a great option because as soon as you come across a third-party component that doesn't specify some required attributes in its template you have to opt-out.
I do agree that it's a good change though.
It will break a lot of existing directives... What is profit of that change? If attribute is not marked as optional but in code of directive it is optional (sometimes even with checks, if it's function in scope.variable) - it will work.
@caitp - I am also feeling uncomfortable about this change.
This way, we do not break existing directives; plus we provide a way for directive developers to specify optional expressions and easily check for their existence in the template, etc.
What do you think?
…t specified BREAKING CHANGE: Previously, '&' expressions would always set up a function in the isolate scope. Now, if the binding is marked as optional and the attribute is not specified, no function will be added to the isolate scope. Closes #6404
Sorry for digging out an old thread. I noticed that there is a breaking change regarding
This example throws with an exception when you try to toggle the second zippy because it doesn't use the
The same example using