Skip to content

Instantly share code, notes, and snippets.

@davidbgk davidbgk/stimulus.html
Last active Mar 27, 2018

What would you like to do?
Playing with Stimulus tutorial
<!doctype html>
<meta charset=utf-8>
<title>Hello Stimulus</title>
<script src=""></script>
window.addEventListener('DOMContentLoaded', _ => {
const application = Stimulus.Application.start()
application.register('hello', class extends Stimulus.Controller {
static get targets () {
return ['name']
greet () {
console.log(`Hello, ${}!`)
get name () {
return this.nameTarget.value
<div data-controller=hello>
<input type=text data-action=hello#greet>
<button data-action=hello#greet>Greet</button>

This comment has been minimized.


This comment has been minimized.

Copy link
Owner Author

davidbgk commented Mar 27, 2018

Note that stimulusjs/stimulus#131 has been merged since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.