You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I've tracked this down and fixed it too. However, not sure if this is tightened AJS 1.4.9 code or a discarded 'feechure' from before. Basically, in 1.4.7 it was allowed to 'optionally' pass an isolate scope attribute ('=') to a directive and still assign a value (object literal) to it inside the directive if I didn't pass it in. In 1.4.9, however, if I don't pass the 'optional' attribute, I get the above error and, to fix it, I must pass the attribute with an empty object literal assigned.
Below is simple pseudocode for A: WORKED (1.4.7) and B: WORKS w/Fix ( after 1.4.9 I get error above).
A: WORKED:(1.4.7. I don't need to pass optional attribute to directive and yet can assign it inside directive) mydirective.js:
...scope: {attrObjectLiteral:'='}...... //isolate scope attr definition
....
$scope.attrObjectLiteral = someObjectLiteral; // assigned isolate scope attr to some data
html usage:
html:
<my-directive></my-directive> //sometimes I don't need to pass the attribute (works in 1.4.7 an not 1.4.7)
<my-directive attr-object-literal="some.data"></my-directive> //sometimes I DO need to pass the attr. Works in 1.4.7 and 1.4.9 as well.
The above worked in 1.4.7 and doesn't work in 1.4.9 (and beyond?). Fix below. Instead of not passing the optional isolate attribute, pass it assigned to an empty object literal.
B: WORKS w/Fix ( after 1.4.9 I get error above. I MUST pass an optional attribute initialized to an empty object literal if I assign an object to it inside the directive.): mydirective.js:
...scope: {attrObjectLiteral:'='}...... //isolate scope attr definition
$scope.attrObjectLiteral = someObjectLiteral; // assigned isolate scope attr to some data
html usage:
html:
<my-directive attr-object-literal="{}"></my-directive> //sometimes I don't need to pass the attribute (had to pass empty obj literal)
<my-directive attr-object-literal="some.data"></my-directive> //sometimes I DO need to pass the attr. Works in 1.4.7 and 1.4.9 as well.
I liked the optionality of the isolate scope attribute. Thoughts?
Thanks!
Mo
The text was updated successfully, but these errors were encountered:
tl;dr:
This is working as expected now. The previous behavior was a regression (that took us quite some time to fix). If you want to have optional bindings you should use =?.
I've tracked this down and fixed it too. However, not sure if this is tightened AJS 1.4.9 code or a discarded 'feechure' from before. Basically, in 1.4.7 it was allowed to 'optionally' pass an isolate scope attribute ('=') to a directive and still assign a value (object literal) to it inside the directive if I didn't pass it in. In 1.4.9, however, if I don't pass the 'optional' attribute, I get the above error and, to fix it, I must pass the attribute with an empty object literal assigned.
Below is simple pseudocode for A: WORKED (1.4.7) and B: WORKS w/Fix ( after 1.4.9 I get error above).
A: WORKED:(1.4.7. I don't need to pass optional attribute to directive and yet can assign it inside directive)
mydirective.js:
html:
The above worked in 1.4.7 and doesn't work in 1.4.9 (and beyond?). Fix below. Instead of not passing the optional isolate attribute, pass it assigned to an empty object literal.
B: WORKS w/Fix ( after 1.4.9 I get error above. I MUST pass an optional attribute initialized to an empty object literal if I assign an object to it inside the directive.):
mydirective.js:
html:
I liked the optionality of the isolate scope attribute. Thoughts?
Thanks!
Mo
The text was updated successfully, but these errors were encountered: