How to handle 'no route matched' in Ember.js and show 404 page?

后端 未结 5 397
无人共我
无人共我 2020-12-08 18:55

How can I handle the error

Uncaught Error: No route matched the URL \'...\'

and show a custom 404 page?


Note: This questi

5条回答
  •  -上瘾入骨i
    2020-12-08 19:19

    You could try adding a catch-all route at the end of your router:

    App.Router.map(function() {
      this.resource('post', ...);
      this.resource('user', ...);
      this.route('catchAll', { path: '/*' });
    });
    
    App.CatchAllRoute = ...
    

提交回复
热议问题