Running ember app alongside other app running on rails


#1

i have an app with multiple tabs having different features, i have developed one of the feature in ember, now i want to render the ember app inside the main rails app, i have tried to set the rootElement to the id of the div in which i want to render the ember app https://guides.emberjs.com/v2.5.0/configuring-ember/embedding-applications/ , but it didn’t work, tried ember-islands it didn’t work too, is there anything else i need to do other that setting the rootElement? pls help.


#2

Could you give us a little more context as to the scope of the problem? Are you getting javascript errors in your console? Is the page successfully requesting the correct javascript and css files? Are you having trouble setting up the how do I serve a SPA in rails?

One thing I know is you’ll probably also have to set your rootUrl to the url of the page on which it is rendering (for instance if you are rendering on the page /my-feature you’ll want to set your root url to ‘/my-feature/’. Another thing we’ve run in to is that (I think) ember has a problem when the page doesn’t have an ending forward slash, so we have JS on the rails page that says

if(window.location.pathname === '/my-feature') {
  window.location.pathname = '/my-feature/';
}

(Not the best but it works)