Importing custom Alpine data
I'm trying to define a custom alpine data like this:
But I get the error: module.esm.js:423 Uncaught ReferenceError: reservationTimeline is not defined
What am I doing wrong? π
4 Replies
My reservationTimeline.js :
Apparently
import Alpine from "alpinejs"
was the issue. I don't know how does he get the context in that listener but it works now π
This is closed, but if someone wants to explain how does the listener resolve Alpine inside please do πAlpine provides itself as part of the alpine:init event callback.
So your script never runs until alpine calls it.