Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

stimulus value

<div data-controller="loader"
     data-loader-url-value="/messages">
</div>
// controllers/loader_controller.js
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static values = {
    url: String
  }

  connect() {
    fetch(this.urlValue).then(/* … */)
  }
}
Source by stimulus.hotwired.dev #
 
PREVIOUS NEXT
Tagged: #stimulus
ADD COMMENT
Topic
Name
5+6 =