祝你好,StackOverflow,
// routes
Router.map(function() {
this.resource('myresource');
this.resource('myresource', { path: 'myresource/:param1' });
});
// call transition from controller when switch not selected any params
// doesn't work...
this.transitionToRoute('myresource');
需要帮助,如果未选择 View 中的任何参数,我想转到“domain.tld/myresource”。但这不起作用:(
最佳答案
// router
Router.map(function() {
this.route('myresource');
this.route('anothermyresource', { path: 'myresource/: param1' });
});
// router extend for another my resource
setupController: function(controller, model) {
this.controllerFor('myresource').setProperties({isNew:false, content:model});
},
renderTemplate: function() {
this.render('myresource');
},
model: function (params) {
if (params.param1 === 'paramValue') return this.store.find('resource', {param1: 0});
}
// and now work like as need
this.transitionToRoute('myresource');
关于javascript - this.transitionToRoute 在没有参数的情况下不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34051030/