Reputation: 187
I'm rendering a static HTML page with phantom.js for SEO purposes inside a Node.JS backend according to Google's AJAX crawling specification (?_escaped_fragment_=...
). The front-end application is written in Ember (version 1.0.0
).
I noticed while testing those static HTML URLs inside my browser that Ember cannot be re-initialised, leading to errors like
Assertion failed: You cannot use the same root element (body) multiple times in an Ember.Application
Assertion failed: You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application
I was wondering if:
<body class="ember-application">
or <script id="metamorph-7-start" type="text/x-placeholder"></script>
Upvotes: 1
Views: 1331
Reputation: 19128
You receive this error because you are declaring more than one ember app, in the same rootElement:
// ok
App = Ember.Application.create({ rootElement: "#wizard" });
/// rootElement default to "body"
App = Ember.Application.create();
// throw error. we already have a ember app with rootElement equals to "body"
App = Ember.Application.create();
To reinitialize the app you can use the reset method:
App.reset();
Upvotes: 2