Override existing catch-all wildcard route

You could use two flat routes:

this.route('main-route', { path: '/:path' });
this.route('main-route-with-more-args', { path: '/:path/*wildcard_path' });

And then reexport the implementation of that route so main-route-with-more-args does the same thing as main-route:

// app/routes/main-route-with-more-args.js
export { default } from './main-route';

// app/templates/main-route-with-more-args.js
export { default } from './main-route'

// app/controllers/main-route-with-more-args.js
export { default } from './main-route';

Alternatively, maybe the nested structure you already have is OK. The beforeModel hook in main-route will fire when you enter either URL. It won’t re-fire if you switch between them, but for that you could use beforeModel in main-route.index and main-route.sub-route.

1 Like