Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set attributes via locals #137

Open
thewebartisan7 opened this issue Oct 6, 2022 · 1 comment
Open

Set attributes via locals #137

thewebartisan7 opened this issue Oct 6, 2022 · 1 comment

Comments

@thewebartisan7
Copy link

thewebartisan7 commented Oct 6, 2022

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?

@thewebartisan7
Copy link
Author

I made a small plugin for handle this, it's pretty easy. Will publish it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant