Clarify how to declare multi-word controller names in docs
See original GitHub issueJust something you might want to add to the docs eventually. After some experimenting with trying to get a multi-word controller working. I eventually realized that it has to be separated by a -
instead of a _
like the controller file itself needs to be named.
<div data-controller="option-panel">
<div data-target="option-panel.widget"></div>
<div data-action="click->option-panel#show"></div>
</div>
… which points to …
option_panel_controller.js
At first, I was putting _
in the markup data attributes before I realized it was a dash. This might be assumed by some folks, but still might not be a bad idea to mention it in the docs or in an FAQ somewhere.
I’m happy to submit a pull request for this as well but wasn’t sure where or how you’d want to include this in the handbook.
Cheers 😃
Issue Analytics
- State:
- Created 6 years ago
- Reactions:22
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Clarify how to declare multi-word controller names in docs #62
After some experimenting with trying to get a multi-word controller working. I eventually realized that it has to be separated by a -...
Read more >Keyboard shortcuts for Google Docs
Keyboard shortcuts for Google Docs ; Bold, Ctrl + b ; Italicize, Ctrl + i ; Underline, Ctrl + u ; Strikethrough, Alt...
Read more >ESLint Vue multiword components - Stack Overflow
There's a simple solution. You need define your component name with more than one word as it states. Should be ...
Read more >A simple sway to generate controlled documents - QbDVision
First things first, let's clarify: we use Google Docs for drafting and collaborating on our controlled documents. Our final, approved controlled ...
Read more >10 JavaScript Naming Conventions Every Developer Should ...
1. Naming Convention for Variables. JavaScript variable names are case-sensitive. Lowercase and uppercase letters are distinct. For example, you ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @javan. As someone who is struggling a little with this right now, I’d love to help clarify it for other newcomers. Your link above 404s, and I’m struggling to find the right “vanilla” way of doing this.
e.g. Using without a Build System states the following:
Should the
"hello"
be"hello-world"
or"helloWorld"
? I feel like it should behelloWorld
but I can only get it to work with the data-controller if it’shello-world
.Perhaps it might be clearer if examples were two-word controllers to begin with – as it’s (arguably) easier to work backwards from two words than forwards from one?
Happy to help if I can. Thanks. 👍
Thank you for the feedback! We do have the webpack filename-to-identifier mapping documented, but I agree it’s not at all obvious. I’d like to see if we can work this into the Handbook.