Question

I know something like this can be done but what I'm asking for is an else route that will match any URL (or state) that wasn't previously defined.

This could be handy to catch if a user is trying to access an invalid state or URL.

However, is okey if there is another way to do this :D

Hope this makes sense.

Était-ce utile?

La solution

This is taken from the answer to another question, so upvote that one:

App.Router.map(function() {
  this.route('catchAll', { path: '*:' });
});

App.CatchAllRoute = Ember.Route.extend({ 
    redirect: function() {
        this.transitionTo('index'); 
    }
});
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top