在Ember.JS中为单个路由禁用application.hbs

时间:2016-12-22 14:55:51

标签: ember.js

简单地说,Web应用程序需要99%的时间使用application.hbs模板,但对于单个路由,我想禁用它并仅渲染路由模板。

喜欢'布局= null;'在asp.net

提前致谢。

1 个答案:

答案 0 :(得分:2)

最简单的答案是,您需要在共同的父路线下嵌套共享布局的所有路线,因为您无法删除应用程序模板。这可以通过几种不同的方式完成,具体取决于目标。

如果他们共享一个网址细分,您可以将其置于一个共同的父级:

Router.map(function() {
  this.route('pretty-layout', function() {
    this.route('page-1'); // http://localhost:4200/pretty-layout/page-1
    this.route('page-2'); // http://localhost:4200/pretty-layout/page-2
  });
});

您可以覆盖顶级索引路由。您可能需要将当前application.index移至application.index.index

 Router.map(function() {
  this.route('index', { path: '/' }, function() {
    this.route('page-1'); // http://localhost:4200/page-1
    this.route('page-2'); // http://localhost:4200/page-2
  });
});