Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Connect a Stimulus Controller to your html


    The first thing you need to do is add the data-controller attribute the to html that you want to connect to Stimulus.

    We added data-controller="example" so Stimulus expects an example_controller.js file to exist.

    In our ExampleController class, we are going to use the connect method to show that we've connected our controller to the dom.