Skip to content

Instantly share code, notes, and snippets.

@romanbsd
Created February 29, 2024 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romanbsd/4122d6594f235677cc42318205ef6509 to your computer and use it in GitHub Desktop.
Save romanbsd/4122d6594f235677cc42318205ef6509 to your computer and use it in GitHub Desktop.
import Chart from 'stimulus-chartjs'
// Connects to data-controller="async-chart"
export default class extends Chart {
static values = {
url: String
}
connect() {
fetch(this.urlValue)
.then(response => response.json())
.then(data => {
this.dataValue = data
super.connect()
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment