angular 2 route to 404 page when route param is invalid

后端 未结 4 1835
闹比i
闹比i 2021-02-14 01:17

Say I have an route with a param like this (in Angular 2): /user1/products/:id, which could have child routes like /user1/products/3/reviews.

W

4条回答
  •  时光说笑
    2021-02-14 02:10

    As of Angular 2 final this is the solution:

    this._router.navigateByUrl('/404', { skipLocationChange: true })
    

提交回复
热议问题