我的项目是使用ember-cli和ES6导入方法的ember.js。

这个问题是关于将子资源newdataset路由渲染到应用程序{{ outlet 'sidebar' }}中,而数据集(显示)上的其他路由渲染到{{ outlet 'main' }}

application.hbs

<div class="col-xs-8">
  Outlet Main
  {{liquid-outlet "main"}}
</div>
<div class="col-xs-4">
  Outlet Sidebar
 {{liquid-outlet "sidebar"}}
</div>


router.js

this.resource('organizations', function() {
    this.route('new');
    this.resource('organization', { path: '/:organization_id' }, function() {
      this.route('edit');
      this.resource('datasets', function() {
        this.route('new');
        this.resource('dataset', { path: '/:dataset_id' }, function() {
          this.route('edit');
        });
      });
    });
  });


路由/organization.js:

import Ember from 'ember';

export default Ember.Route.extend({
  renderTemplate: function() {
    //render into application so organizations template doesn't show
    this.render('organization', {
      into: 'application',
      outlet: 'main',
      controller: 'organization'
    });
    // **** Not working but roughly what I want to do
    this.render('organization.datasets.new', {
      into: 'application',
      outlet: 'sidebar',
      controller: 'organization.datasets.new'
    });
    // ******
  }
});


目前,尝试此代码时出现此错误:

Error while processing route: types.index You passed `controller: 'organization.datasets.new'` into the `render` method, but no such controller could be found. Error: You passed `controller: 'organization.datasets.new'` into the `render` method, but no such controller could be found.


我的理解是,任何子资源路径都应在父路径中确定。真正?
我如何获得余烬来识别控制器?我猜我的语法是错误的...
谢谢您的帮助。

最佳答案

你有尝试过吗?

this.render('organization/datasets/new', {
  into: 'application',
  outlet: 'sidebar',
  controller: 'organization/datasets/new'
});


使用“ /”代替“。”。

10-04 16:33