如何打开Ember v2路由器API中的控制台日志记录?

时间:2013-01-02 00:04:21

标签: ember.js router

在路由器API的v1中,您可以设置此标志:

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

路由器会将状态更改记录到console.log,这有助于调试。这似乎不再起作用了 - 有没有人知道这个标志是否有新的等价物?

2 个答案:

答案 0 :(得分:9)

1bf0df4提交以来:

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

答案 1 :(得分: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);
  }
});

*/

请注意,此注释实际上位于已在新路由更改中合并的主分支的源代码中。我不得不得出结论,这是一个错误,可能会在不久的将来(希望)得到解决。