Ember.js 每次我想去一个路由路径,当一个无效的路径是给定的

Ember.js 每次我想去一个路由路径,当一个无效的路径是给定的,ember.js,Ember.js,我想转到/templates,只要有任何无效路径被指定为like/errowquery。在路由器的末尾添加一个 import EmberRouter from '@ember/routing/router'; const Router = EmberRouter.extend({ }); Router.map(function() { this.route('index', {path: '/templates'}); this.route('show', {path:

我想转到/templates,只要有任何无效路径被指定为like/errowquery。

在路由器的末尾添加一个

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;
创建一个未找到的路由,并将其用于您的用户/模板

Router.map(function() { 
    this.route('index', {path: '/templates'}); 
    this.route('show', {path: '/templates/:id'}); 
    this.route('not-found', { path: '/*path' });
});
在路由器的末尾添加一个

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;
创建一个未找到的路由,并将其用于您的用户/模板

Router.map(function() { 
    this.route('index', {path: '/templates'}); 
    this.route('show', {path: '/templates/:id'}); 
    this.route('not-found', { path: '/*path' });
});