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

Proposal for one-way binding option #13900

Closed
@robstove

Description

@robstove

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.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions