使用渲染时,具有嵌套资源的资源未加载到后退按钮上
Resource with nested resource not loading on back button when using render
我的emberjs代码在下面的jsbin中,
http://emberjs.jsbin.com/rewumojixe
我试图将 "search" 资源嵌套在我的 "cars" 资源中,因为我希望路由为 cars/search 。我已经使用 renderTemplate 在应用程序插座中加载搜索资源以替换呈现的汽车模板。
App.SearchRoute = Ember.Route.extend({
renderTemplate: function () {
this.render('search', { into: 'application' });
}
});
除了在搜索路线上单击后退按钮时正在加载空车外,这工作正常 route.This 仅当将上述 renderTemplate 代码添加到 SearchRoute 时才会发生。
如果你不想嵌套路由,就不要嵌套它们。
App.Router.map(function() {
this.resource('home', { path: '/' });
this.resource('cars', { path: '/cars' });
this.resource('search', { path: '/cars/search' });
});
演示:
我的emberjs代码在下面的jsbin中,
http://emberjs.jsbin.com/rewumojixe
我试图将 "search" 资源嵌套在我的 "cars" 资源中,因为我希望路由为 cars/search 。我已经使用 renderTemplate 在应用程序插座中加载搜索资源以替换呈现的汽车模板。
App.SearchRoute = Ember.Route.extend({
renderTemplate: function () {
this.render('search', { into: 'application' });
}
});
除了在搜索路线上单击后退按钮时正在加载空车外,这工作正常 route.This 仅当将上述 renderTemplate 代码添加到 SearchRoute 时才会发生。
如果你不想嵌套路由,就不要嵌套它们。
App.Router.map(function() {
this.resource('home', { path: '/' });
this.resource('cars', { path: '/cars' });
this.resource('search', { path: '/cars/search' });
});
演示: