当url指定了不存在的路由时,ember默认路由

时间:2016-02-22 15:09:05

标签: ember.js ember-cli

如果在URL中指定了不存在的位置,我如何告诉ember显示默认路由?

让我说我的默认路线的ember应用为'home':

http://localhost:50000/#/home

效果很好。

但是,让我们说用户从某处获得了一个错误的网址并尝试访问:

http://localhost:50000/#/non-existing

我的应用中发生的事情是没有显示任何内容。 如果指定了不存在的路由,我如何告诉ember使用默认路由?

这是我的router.js的简化版本

import Ember from 'ember';
import config from './config/environment';

var Router = Ember.Router.extend({
    location: config.locationType
});

Router.map(function() {
  this.route('home', {path: '/'});
  this.route('about');
});

export default Router;

我使用ember-cli和最新版本的ember.js

0 个答案:

没有答案