4

我正在使用 Ember.Facebook mixin (https://github.com/luan/ember-facebook) 创建一个 ember 应用程序,它需要将 Ember 应用程序定义为:

App = Ember.Application.create(Em.Facebook);

但是,我需要为我的应用程序定义一些参数,例如

{
rootElement: 'survey',
autoinit: false,
nextStep: 1,
appId: 113411778806173
}

理想情况下,这些是使用添加到应用程序中的

App = Ember.Application.create({
  rootElement: 'survey',
  autoinit: false,
  nextStep: 1,
  appId: 113411778806173
});

以便它们在运行时存在,但是有必要将 App.setProperties() 与 ember.facebook mixin 一起使用。

如何在 Em.Application.create() 调用中定义 mixin 和参数?

4

1 回答 1

13

在 ember master 中,使用:

App = Ember.Application.createWithMixins(Em.Facebook, {
  rootElement: 'survey',
  autoinit: false,
  nextStep: 1,
  appId: 113411778806173
});

在之前的 ember 版本中,您可以使用create相同的语法。

于 2012-12-14T12:33:02.067 回答