lundi 22 février 2016

ember default route when url has non-existing route specified

How can I tell ember to show the default route when a non-existing location is specified in the URL?

Lets say I have my ember app with default route as 'home':

http://localhost:50000/#/home

That works well.

But lets say the user has gotten a bad URL from somewhere and tries to visit:

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

What happens in my app is that nothing is displayed. How can I tell ember to use the default route whenever a non-existing route is specified?

Here is a simplified version of my 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;

I use ember-cli and latest version of ember.js




Aucun commentaire:

Enregistrer un commentaire