1

我有点疯了......在JSFiddle上成功实现了一个简单的测试之后。我决定使用 brunch 的 ember-reloaded 模板在本地构建相同的应用程序。它几乎可以工作(我认为),但我无法让主模板——activity.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" );
      }
    }

});

这有道理吗?我已经看到其他几个人发布了有关此错误的帖子,但我没有发现与我所经历的直接相关。

顺便说一句,对于其他上下文,这是我的初始化脚本,它使您可以查看我定义的各种对象。为简洁起见,我没有包括所有源代码(尽管每个文件都很短):

// 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');
4

0 回答 0