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.

Support is-attribute="booleanExpression" for configuring boolean attributes #8252

@ewinslow

Description

@ewinslow

In my brief tests, it seemed like ng-attr-* doesn't do the "right" thing for boolean attributes:

<input ng-attr-disabled="{{true}}">

I was kind of hoping this would result in:

<input disabled>

But it doesn't.

Now, I realize there is ng-disabled for this specific case. And there are many others that angular explicitly covers. However, I don't think this is really maintainable since there are attributes that aren't covered as it is, and new attributes come out all the time. Especially with Custom Elements being bigger thing these days, there is no general way to predict what new boolean attributes will crop up.

Wouldn't it just be nicer if all boolean attributes could be automatically handled the same way instead of being special-cased?

<input is-disabled="true">

Lovely. Clear. Simple. Maintainable.

And of course you're always free to prefix for consistency with the rest of the framework (ng-is-disabled).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions