2013-03-05 13 views
0

我試圖使用Ember.js與Require.js但我有一個奇怪的錯誤,當我想要做一些途徑與此代碼:App.Router不確定與Ember和要求

define([ 
    'lib/ember/load', 
    "app/views/main-views", 
    "app/views/nav-views", 
    "app/views/body-views" 
], function(em, MainViews, NavViews, BodyViews) { 

    // Create a local namespace for the app 
    var App = Ember.Application.create(); 
    em.App = App; 

    App.Router.map(function() { 
     this.route("about"); 
    }); 


    // Export it from the module. 
    return App; 
}); 

我有:cannot call map of undefined

也許,這是一個RequireJS配置問題?但我認爲所有數據都正確加載。

非常感謝。

回答

0

我知道這是一箇舊帖子,但我認爲問題在於您嘗試設置不允許的Ember對象的屬性(em.App = App)。所以這會導致錯誤 - 如果您嘗試使用工作的燼project項目爲Ember對象設置屬性,則最終會出現相同的行爲。

我有一個用requirejs設置的ember項目,還有模板預編譯的grunt自動化,你應該在github上檢查一下。