import EmberRouter from '@ember/routing/router';
const Router = EmberRouter.extend({
});
Router.map(function() {
this.route('index', {path: '/templates'});
this.route('show', {path: '/templates/:id'});
});
export default Router;
Я хочу перейти к / templates, когда указан какой-либо недопустимый путь, например / неправильный запрос.
Добавьте маршрут с подстановочными знаками в конец вашего роутера
Router.map(function() {
this.route('index', {path: '/templates'});
this.route('show', {path: '/templates/:id'});
this.route('not-found', { path: '/*path' });
});
Создайте ненайденный маршрут и используйте его для переход ваших пользователей в / templates.
export default Route.extend({
beforeModel() {
this.transitionTo('index');
}
});