I'm moving my project from Ember AppKit to Ember-Cli. I have an myapp/app/app.js, where the app is initialized and in myapp/app/index.html I have the following lines:
var config = require('myapp/config/environment')['default'];
window.App = require('myapp/app')["default"].create(config.APP);
*config is not that important in my question.
So when I run the ember server I see that app.js was called twice. For the first time, automatically, I guess, and the second call is made by create() function from above. So after running the server I get an error:
"Uncaught Error: Assertion Failed: You cannot use the same root element (body) multiple times in an Ember.Application "
I know that the error means that I'm creating two instances of my app in the same DOM-Object and it can be solved by creating two sub containers () with different ids.
But how do I avoid creating the first instance, which is done automatically, before I actually call create()? Without the lines shown above the app is not shown at all, but with them I get the mentioned error. I have checked the whole app implementation, there is nothing what would call the initial instance creation, before create() function from above.
I didn't have that mistake in EmberAppKit running Grunt
In Ember CLI config lives in
/config/environment.js
, and it will be handed to your app automatically. You shouldn't need to this manually.