【问题标题】:Ember-cli Pods & Loading TemplatesEmber-cli Pod 和加载模板
【发布时间】:2015-08-14 02:07:05
【问题描述】:

我为正在运行的应用程序创建了一个加载模板,现在我正在尝试为我的路线创建自定义加载模板,但我无法正常工作。

这是我的文件结构(使用 pod)。

- app
- | pods
- - | application
- - - - adapter.js
- - - - template.hbs
- - | loading
- - - - template.hbs
- - | author
- - - - model.js
- - - | show
- - - - controller.js
- - - - route.js
- - - - template.hbs
- - - - | loading
- - - - - - template.hbs

这是我的 router.js

Router.map(function()
{
  this.route('author.show', { path: '/author/:author_id' });
});

我正在使用

  • ember 1.13.7
  • ember-cli 1.13.8
  • ember-data 1.13.8

如何为我的“author.show”路由获取自定义加载模板?

【问题讨论】:

    标签: ember.js


    【解决方案1】:

    解决了!

    我需要重新组织我的 router.js 以使用父/子路由格式:

    export default Router.map(function() {
        this.route('author', { path: "authors" }, function() {
            this.route('list', { path: "list" });
            this.route('show', { path: ":id" });
        });
    });
    
    • 路由:作者使用pods/loading
    • 路由:author.list 使用 pods/author/loading
    • 路由:author.show 使用 pods/author/loading

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多