For a detailed review of the code, please check out the plnkr.
I am quite new to AngularJS components. I have created two simple AngularJS components with the exact same bindings:
bindings: { value:'@', field:'@', object: '<', callback: '&' }
In my components, I pass a JavaScript object using the object
binding. The field
parameter specifies the property name within the JS object, while value
indicates the new value for that property.
object[field] = value
If the component doesn't clone the object
in its controller, one-way binding does not function properly (refer to the onewaybindingfail
component in the plnkr). However, cloning the object
in the component's controller resolves this issue.
I would like to understand if this behavior is expected and why it occurs, or if I might be overlooking something.
Thank you for your assistance.