I am using Ember.js and I would like to create a trick of the entire route to send the user back to the root of the application if they go to a URL that does not match the resource. (I use the history API) I implemented it like this:
App.Router.map(function() { this.resource('things', function() { this.resource('thing', {path:':thing_id'}); }); this.route('catchAll', { path: ':*' }); this.route('catchAll', { path: ':*/:*' }); this.route('catchAll', { path: ':*/:*/:*' }); }); App.Router.reopen({ location: 'history' }); App.CatchAllRoute = Ember.Route.extend({ redirect: function() { this.transitionTo('index'); } }); App.IndexRoute = Ember.Route.extend({ });
My question is: can I determine the only way to track all routes that will correspond to any path that was not allowed for the resource, regardless of the number of segments in the path?
I am using Ember.VERSION: 1.0.0-rc.1
i0n
source share