mardi 28 avril 2020

Call ember route from server side rendered app

So I currently have a rails 6.0 and ember (octane) 3.14 app. Ember is being included into the server-side rendered rails template. I configured the ember app to have a rootElement and rootURL as mentioned here: https://guides.emberjs.com/release/configuring-ember/embedding-applications/

This way, ember gets included fine. Problem is now, I would like to use an href or button from the rails template to call a route in the ember app.

My rails application.html:

<div id="ember" class="ember-application">
  <a href="/app/accounts/new">new Account</a>
</div>

The rootURL is configured to /app and the rootElement is #ember

An ember LinkTo element does not seem to have any special event handlers or anything. Those seem to sit on the rootElement so I had the idea of delegating the click event to the rootElement but no luck so far...

Any ideas how I could get this to work?




Aucun commentaire:

Enregistrer un commentaire