How do I fire a Cmd once a page has been routed to?

96 views
Skip to first unread message

Gabe Krambs

unread,
Aug 24, 2016, 12:01:18 PM8/24/16
to Elm Discuss

I have an SPA that has a page that includes a chart. I'm using a JS port to activate/send data to a chart.js chart. When the page is loaded, I'd like to send the chart data via the port. I'm able to wire the commands up fine on events (like a select change, for example), but am at a loss for how to get the command to fire when the page is loaded.


I tried wiring up the command in my app's init, but of course this fires before I've retrieved my app data.


Thanks so much!

OvermindDL1

unread,
Aug 24, 2016, 2:36:06 PM8/24/16
to Elm Discuss
If the data is not available at `init` then when is it available and why are you unable to send a command on 'that' event?

Gabe Krambs

unread,
Aug 24, 2016, 2:44:20 PM8/24/16
to Elm Discuss
Good question. Will play and come back. Thanks!

Gabe Krambs

unread,
Aug 24, 2016, 9:32:17 PM8/24/16
to Elm Discuss
That certainly got me on the right track. Thanks again.
Reply all
Reply to author
Forward
0 new messages