Thanks to visit codestin.com
Credit goes to github.com

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.

Add ng-prop-* to one-way bind an expression to arbitrary element properties #10072

Closed
@ewinslow

Description

@ewinslow

ng-prop-* could take an expression and bind to arbitrary properties:

ng-prop-checked="some.expression"

This would be similar to the current ng-attr-*:

ng-attr-x="{{interpolation}}"

Reasoning:

  1. Angular 2.0 is going this sort of direction. So this will help ease migration. Migration pain is one of the main complaints right now for 2.0, it seems to me.
  2. Get the benefits of the Angular 2.0 approach without waiting 1.5 years.
    • ng-prop-* would always takes an expression, so it's clear what format the right hand side should be, regardless what property is being modified
    • ng-prop-* would work on all properties (like ng-attr-*), even from custom web components
    • etc.?
  3. (Minor) Provides nice symmetry from jQuery API to Angular API: $.fn.prop and $.fn.attr
  4. Binding to arbitrary properties requires custom compiler support to recognize all ng-prop-* attributes without explicitly adding each as separate directives, so this is why I think it belongs in core.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions