【问题标题】:Ember CLI cannot resolve nested partialsEmber CLI 无法解析嵌套部分
【发布时间】:2015-09-24 03:58:57
【问题描述】:

我的application.hbs 文件中使用了一个简单的部分:{{partial "atoms/header_message"}} 部分的路径是templates/atoms/header_message

根据CLI Documentation

模板的名称与其文件名相同,但不包括扩展名(即templates/foo/bar.hbs -> foo/bar)。

所以 pod 结构与否,它应该简单地解析路径。但是我得到了这个奇特的错误:

未捕获的错误:断言失败:无法找到名称为“atoms/header_message”的部分

我是不是命名有误?

【问题讨论】:

    标签: ember.js ember-cli


    【解决方案1】:

    使用破折号代替下划线:)

    【讨论】:

      【解决方案2】:

      您的部分需要用句点而不是斜线来引用。

      {{partial 'atoms.header_message'}}

      【讨论】:

      • 那行不通。我收到以下错误:Uncaught Error: Assertion Failed: templateNames are not allowed to contain periods: _atoms.header_message
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-17
      • 2019-07-21
      相关资源
      最近更新 更多