Reputation: 275
I have an application in Rails. Recently Ember was installed, and is being used on the part of the views. It works fine there. Now, I need to add some ember functionality to the navbar. At the moment navbar is the part of the Rails layout. I've never dealt with ember before, I've only read some tutorials.
The first solution I've found so far is rewriting and moving the navbar from Rails layout to Embers layout. But that seems like a lot of work, and I'm not sure if it is a good idea.
There is also a way, of puting a div named, for example, "ember-app" and root the Ember there. But that works for a whole ember app, and I want only a part in navbar, and something else in the body. Essentially, what I would like to do, is something like this
<body>
<div class="navbar">
*rails things*
<div id="ember-navbar-part></div>
*more rails things*
</div>
<div id="ember-body-part">
</div>
</body>
Is it possible? There are some ember partials things I've found, but they work inside embers app. Maybe moving the navbar into embers app is normal things?
Upvotes: 0
Views: 88
Reputation: 18240
For your use case I recommend you to checkout ember-wormhole.
I think it could allow you to render things from within ember to any div with an given id.
But in general I would strongly recommend you to keep all your view logic in one framework. If you want to use client-side rendering, do all rendering client-side. So if you want to use ember, go full and use it with ember-cli.
Only thins way you will profit from the ecosystem. You will notice when you try to implement ember-wormhole that it would be one line in an ember-cli app, and a lot of work in any other setup.
Also if you use server side navigation you have to boot your ember app after every transition, which is insane!
Upvotes: 1