【发布时间】:2015-04-22 03:08:34
【问题描述】:
我有一个 base-route 封装了我的应用程序中的所有其他路由。
我想让我通过 this.store.find('category') 从商店检索到的类别在我的应用程序中随处可用。
我尝试使用以下代码在基本控制器中检索它:
import Ember from 'ember';
export default Ember.ArrayController.extend({
// retrieve all categories as they are needed in several places
categories: function() {
return this.get('store').find('category');
}
});
并通过以下方式从子控制器创建别名:
categories: Ember.computed.alias('controllers.base.categories')
但它给出了这个错误消息:
未捕获的错误:断言失败:#each 循环的值必须是数组。你通过了 function () { 返回 this.get('store').find('category'); }
我该如何解决我的问题?
【问题讨论】:
标签: ember.js ember-data ember-cli