在JSFiddle成功实施简单测试后,我有点疯狂了。我决定使用brunch的ember-reloaded模板在本地构建相同的应用程序。它几乎可以工作(我认为),但我无法获得主要模板 - activities.hbs - 愉快地加载。相反,我得到了这个错误:
Assertion failed: an Ember.CollectionView's content must implement Ember.Array.
You passed <(generated activities controller):ember204>
它应该引用的活动控制器是(虽然“生成”这个词让我想知道是否有一些魔法发生):
App = require("app");
App.ActivitiesController = Ember.ArrayController.extend({
toggleDetails: function(target) {
target = "#activity-details-" + target;
console.log("Pressed " + target);
if (jQuery(target).is(":hidden")) {
jQuery( target ).slideDown( "fast" );
} else {
jQuery( target ).slideUp( "fast" );
}
}
});
这有什么意义吗?我已经看到其他几个人发布了这个错误,但我没有找到与我正在经历的直接相关。
BTW,对于其他上下文,这里是我的初始化脚本,它可以让您查看我定义的各种对象。为了简单起见,我不包括所有来源(尽管每个文件都很短):
// Namespace
require ('app');
// ===== Router =====
App.Router.map(function() {
this.resource('index', { path: '/' }, function() {});
this.resource('activities', { path: '/activities' }, function() {});
this.resource('hi', { path: '/hi' }, function() {});
});
// ===== Routes =====
require ('routes/ActivitiesRoute');
// ===== Store =====
require('stores/fixture');
// ===== Models =====
require('models/Activity');
// ===== Views =====
require('views/IndexView');
// require('views/ActivitiesView');
// ===== Controllers =====
require ('controllers/ActivitiesController');
// ===== Template Helpers =====
require('helpers/time');
// ===== Templates =====
require ('templates/application');
require ('templates/hi');
require ('templates/activities');