【发布时间】:2013-12-28 04:08:18
【问题描述】:
我有一个 TasksList 应用程序。每个任务中都有 cmets。我正在考虑添加 cmets 作为即插即用的插座。
我有一个显示单个任务的 ViewerRoute:
App.ViewerRoute = Ember.Route.extend({
activate: function () {
$(document).attr('title', 'Task View');
},
renderTemplate: function () {
this.render('Comments', { into: "Viewer", outlet: "comment", controller: "Comment" });
}
});
我的查看器模板有以下 Outlet {{outlet comment}}
我还创建了一个带有一些示例标记的 Comments.hbs 文件:
<div class="row-fluid">
<div class="well span12">
<div class="page-header">
<h3>
Followups
</h3>
</div>
</div>
但是当我运行该页面时,我收到一条错误消息,上面写着“无法调用未定义的方法 connectOutlet”。我将问题三角化到 ember 中的以下函数
_lookupActiveView: function(templateName) {
var active = this._activeViews[templateName]; //templateName is "Comment"
return active && active[0];
},
问题是这个函数总是返回未定义的。
最终当代码运行到parentView.connectOutlet(options.outlet, view);
它遇到了错误。
我错过了什么吗?
这是我的路由器
App.Router.map(function () {
this.resource("taskspanel", function () {
this.resource("viewer", { path: '/viewer/:taskId' }, function () {
});
this.resource("new", { path: '/new' });
});
【问题讨论】:
标签: javascript jquery ember.js ember-router