根据Google的AJAX抓取规范(?_escaped_fragment_=...
),我在Node.JS后端内部使用phantom.js渲染静态HTML页面以进行搜索引擎优化。前端应用程序是用Ember编写的(版本1.0.0
)。
我注意到在我的浏览器中测试那些静态HTML URL时,Ember无法重新初始化,导致错误,如
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
我想知道是否:
<body class="ember-application">
或<script id="metamorph-7-start" type="text/x-placeholder"></script>
答案 0 :(得分:2)
您收到此错误是因为您在同一个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();
要重新初始化应用,您可以使用reset方法:
App.reset();