1

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

Vilhelm H.
  • 1,315
  • 1
  • 7
  • 15
  • 10
    This might be what u need http://stackoverflow.com/questions/14548594/how-to-handle-no-route-matched-in-ember-js-and-show-404-page – blessanm86 Feb 22 '16 at 19:01

0 Answers0