我现在正试图绕过 Ember,但所有的魔法都让这变得困难。
我已经设置了LOG_TRANSITIONS: true
,Ember.LOG_BINDINGS = true;
这给了我一些到控制台的最小日志记录,但我真的需要更多。
当 Ember 自动创建控制器、视图和模板时,我特别难以看到发生了什么。
有没有办法记录框架的这一方面 - 查看 Ember 在哪里寻找模板/视图/控制器以及它何时自行创建。
例如,我设置了以下路线:
App.Router.map(function() {
this.route("example_items", {path: "/"});
});
和:
App.ExampleItemsRoute = Ember.Route.extend({
model: function() {
return App.ExampleItem.find();
}
});
Ember 呈现我的 ApplicationController 及其application.handlebars
模板:
<header class="page-header">
<h1>Application Template</h1>
</header>
{{outlet}}
但无法呈现我的example_items.handlebars
模板。我没有收到任何异常或警告,如果我检查 DOM,我可以看到 ember 已在其位置创建了一个通用视图。
绑定日志显示 Ember 已转换为example_items
,但它似乎没有使用我的 ExampleItemsController、ExampleItemsView 或模板。
如果我没有收到错误或消息,我该如何调试这种情况?
编辑:
App.ExampleItems 视图:
App.ExampleItemsView = Ember.CollectionView.extend({
templateName: 'example_items'
});
和 App.ExampleItemsController:
App.ExampleItemsController = Ember.ArrayController.extend({
});