Skip to content

Set attributes via locals #137

@thewebartisan7

Description

@thewebartisan7

It seem that it's not possible to set attributes via locals, but only values.

So it's not possible to set dynamically the "selected" or "disabled" attribute to a select or input tag.

It's that correct?

I tried several things but seem not working.

Would be possible to set something like:

<select>
<option :selected="{{ selected }}">option 1</option>
<option>option 2</option>
</select>

Notice the ":" before attribute.
When this and when {{ selected }} value is undefined, NULL and/or false, then :selected attribute get removed from tag.

Maybe would better a custom plugin that loop over tag with such attributes and remove attribute when condition match?

What do you think?

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