Sprinkle your Html with controller, target, and action attributes:
data-controller="hello">
data-target="hello.name" type="text">
data-target="hello.output">
Write a compatible controller and watch Stimulus bring it to life:
// hello_controller.js
import { Controller } from "stimulus"export default class extends Controller {
static targets = [ "name", "output" ]
greet() {
this.outputTarget.textContent =
`Hello, ${this.nameTarget.value}!`
}
}
Current version: 1.0.1 — released February 02, 2018
Stimulus is a Javascript Framework with modest ambitions. It doesn’t seek to take over your entire front-end—in fact, it’s not concerned with rendering HTML at all. Instead, it’s designed to augment your HTML with just enough behavior to make it shine. Stimulus pairs beautifully with Turbolinks to provide a complete solution for fast, compelling applications with a minimal amount of effort.
Source link
The post A Modest Javascript Framework for the HTML you already have. appeared first on Nexstair Technologies.
This post first appeared on Nexstair | Creative Website Design And Wordpress T, please read the originial post: here