2012-12-13 49 views
4

我創建使用Ember.Facebook MIXIN(https://github.com/luan/ember-facebook),它要求灰燼應用餘燼應用被定義爲:Ember.Application.create與混入和參數

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 
}); 
應用

,以便它們在運行時存在,但是需要在ember.facebook mixin中使用App.setProperties()。

如何在Em.Application.create()調用中定義mixin和參數?

回答

13

在燼主,用途:

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

在餘燼以前的版本中,你可以使用create具有相同的語法。

+0

可以指定版本嗎?哪一個是以前的版本?引入了哪個版本的'createWithMixin'? –

+0

'createWithMixins'在1.0.0-pre.3中首次發佈 –

+0

我可以在這裏添加它,它不適用於我,直到我這樣做:App.set(「appId」,id);在createWithMixin之後。 –