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

时间:2014-09-01 12:13:42

标签: ember-cli

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

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

App = Ember.Application.create({
  rootElement: '#app-container'
});

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

1 个答案:

答案 0 :(得分:5)

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

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

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

相关问题