1

我有一个带有代码的模板templates/articles.hbs

{{view "carousel"}}

上面的说法一定是正确的,正如入门中所说:https ://github.com/stefanpenner/ember-app-kit/wiki/Getting-Started#resolving-from-template-helpers

views/carousel.js中的简单代码:

var CarouselView = Ember.View.extend({    
    classNames: ['carousel']
});
export default CarouselView;

然而,这会导致以下错误:

Assertion failed: Unable to find view at path 'carousel' ember.js:3231
Assertion failed: You must pass a view to the #view helper, not carousel () 

我尝试将 carousel.js 添加到 views/articles/carousel.js。我尝试了不同的{{view}}名称,例如 App.CarouselView 等,但这一切都不起作用。

伙计们,我在这里缺少什么?

4

1 回答 1

2

在指南中,它说您必须将视图类传递给视图助手,错误消息也是如此。wiki 可能已经过时了。

另外我认为你错误地定义var CarouselView =而不是App.CarouselView = ...

于 2014-01-08T14:05:27.323 回答