diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js index 5975c07..7571df8 100644 --- a/app/javascript/controllers/hello_controller.js +++ b/app/javascript/controllers/hello_controller.js @@ -1,7 +1,16 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { + static targets = [ "name", "output" ] + connect() { - this.element.textContent = "Hello World!" + // this.element.textContent = "Hello World!" + console.log('Hello World hello_controller.js'); + } + + greet() { + console.log('greet'); + this.outputTarget.textContent = + `Hello, ${this.nameTarget.value}!` } } diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 30e0a75..be4bade 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -1,3 +1,17 @@

Welcome

<%= link_to "Articles", articles_path %> + + +

Stimulus Check

+ +
+ + + + + + +