2013-01-02 31 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

相关问题