2013-01-02 96 views
4

在路由器API的第一版,你可以設置這個標誌:如何在Ember v2路由器API中打開控制檯日誌記錄?

App.Router = Ember.Router.extend({ 
    enableLogging: true 
}); 

和路由器將記錄狀態更改爲CONSOLE.LOG,這對調試很有幫助。這似乎不再有效 - 有人知道這個標誌是否有新的等價物嗎?

+0

我通過新路由器的痛苦也發生了變化。我很矛盾關於新的變化。我喜歡它最初(它是如此的軌道狀!)但到目前爲止,他們似乎膚淺至多,缺乏範圍..arg .. – hankang

回答

9

由於1bf0df4承諾:

App = Ember.Application.create({ 
    LOG_TRANSITIONS: true 
}); 
+0

太棒了,謝謝! – estoner

+1

我的應用程序不使用創建。它使用擴展。它似乎並沒有工作。這是什麼文件?我在/root/app/app.js – ahnbizcad

0

我不認爲這還有待於在主分支就制定出來的,我可以告訴大家:我有,但是發現在源代碼中的相關評論:

/* For me this comment starts on line 23202 on build v1.0.0-pre.2-233-g2db13c3 

In addition to creating your application's router, `Ember.Application` is 
also responsible for telling the router when to start routing. 

By default, the router will begin trying to translate the current URL into 
application state once the browser emits the `DOMContentReady` event. If you 
need to defer routing, you can call the application's `deferReadiness()` 
method. Once routing can begin, call the `advanceReadiness()` method. 

If there is any setup required before routing begins, you can implement a 
`ready()` method on your app that will be invoked immediately before routing 
begins: 

window.App = Ember.Application.create({ 
    ready: function() { 
    this.set('router.enableLogging', true); 
    } 
}); 

*/ 

注意這個註釋實際上是在已經合併在新的路由變化中的主分支的源代碼中。我不得不認爲這是一個錯誤,並且很可能會在不久的將來得到解決(希望)。

+0

是的,我應該提到,我挖通過源,並嘗試了,並得到一個錯誤。我假設它尚未完成。 – estoner

相關問題