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'd like to propose a way to allow directives to support one-way binding. Currently this is not an option and the only way to capture data from parent scope is by using two-way '=' binding or '&' binding. '&' binding would work but creates a semantic issue because it is expression based. To solve this a new binding option needs to be added so that we can do something like this:
scope: {
myOneWayProperty: '-'
}
When the one-way binding option is specified this indicates that the scope property should be replaced with the evaluated value from $parent scope.
This change allows the developer to bind an isolate scope / controller property
to an expression, using a `<` binding, in such a way that if the value of the
expression changes, the scope/controller property is updated but not the
converse.
This makes it easier to build AngularJS applications that have unidirectional
data flow.
The binding is implemented simply as a single watch, which can also provide
performance benefits over two way bindings.
Closes#13928Closes#13854Closes#12835Closes#13900
This change allows the developer to bind an isolate scope / controller property
to an expression, using a `<` binding, in such a way that if the value of the
expression changes, the scope/controller property is updated but not the
converse.
The binding is implemented as a single simple watch, which can also provide
performance benefits over two way bindings.
Closes#13928Closes#13854Closes#12835Closes#13900
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'd like to propose a way to allow directives to support one-way binding. Currently this is not an option and the only way to capture data from parent scope is by using two-way '=' binding or '&' binding. '&' binding would work but creates a semantic issue because it is expression based. To solve this a new binding option needs to be added so that we can do something like this:
When the one-way binding option is specified this indicates that the scope property should be replaced with the evaluated value from $parent scope.
scope.myOneWayProperty = $parse(scope.myOneWayProperty)(scope.$parent);
With this option we can now pass objects to a directive without the need for two watches and without having function callback semantic
The text was updated successfully, but these errors were encountered: