Replies: 1 comment
-
|
@marcoroth could you please elaborate? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
we recently added stimulus to our application and began using outlets shortly thereafter.
We could not help but wonder why outlets are matched by selector instead of by controller name.
I assumed that you could add multiple batches of outlets using the same controller like so:
(given that
.adminand.moderatorboth useUserController).I discovered today that this is not possible, because stimulus checks that the controller name matches the name of the outlet.
Now my question: Why did you choose to introduce a selector in the first place?
We ended up setting the selector to
[data-controller="user"], because we don't want to introduce any none-style related classes into our html.Matching by controller would allow for a much clearer syntax like:
which would not only be much easier to understand (I personally find the current example in the documentation confusing), but also grant the opportunity to supply multiple outlets in one attribute (just like we do in the
data-controllerattribute).Please let me know if I'm missing something here.
I'd be glad to work on this, should it be taken into consideration.
Beta Was this translation helpful? Give feedback.
All reactions