嵌入使用ember-cli构建的应用程序(在哪里指定rootElement?)

Lar*_*sJK 4 ember-cli

我需要将一个用ember-cli制作的ember应用程序嵌入到现有的网站中.

如果没有ember-cli,我会这样做:

App = Ember.Application.create({
  rootElement: '#app-container'
});
Run Code Online (Sandbox Code Playgroud)

我基本上希望将生成的资源包含到我的页面中,而不是使用index.html文件..(应用程序需要绑定到div而不是body元素..)

Lar*_*sJK 5

哇.不敢相信我没有尝试过这个..

var App = Ember.Application.extend({
  modulePrefix: 'kontrollpanel', // TODO: loaded via config
  Resolver: Resolver,
  rootElement: '#myapp'
});
Run Code Online (Sandbox Code Playgroud)

我想我对使用Application.extend()而不是Application.create()感到困惑.至于为什么ember-cli使用extend我在这里找到了答案:SO:为什么ember cli使用extend而不是create