Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember.js: a way to do a real catch all route?

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.

like image 936
Diosney Avatar asked Dec 01 '22 22:12

Diosney


1 Answers

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'); 
    }
});
like image 63
flynfish Avatar answered Dec 06 '22 01:12

flynfish