javascript - Angular: 404 page but keep url - Stack Overflow

I wrote a custom 404 page in Angular 4 and want to keep the wrong url that was entered.You can see the

I wrote a custom 404 page in Angular 4 and want to keep the wrong url that was entered. You can see the behavior on github for example. They display a 404 page for not existing urls. Example:

Currently I configured my router like this:

{ path: '404', ponent: NotFoundComponent },
{ path: '**', redirectTo: '404' }

Any idea how to archive this?

I wrote a custom 404 page in Angular 4 and want to keep the wrong url that was entered. You can see the behavior on github for example. They display a 404 page for not existing urls. Example: https://github./cdkdfjkdjf

Currently I configured my router like this:

{ path: '404', ponent: NotFoundComponent },
{ path: '**', redirectTo: '404' }

Any idea how to archive this?

Share Improve this question edited Aug 30, 2017 at 18:42 Lazar Ljubenović 19.8k10 gold badges58 silver badges95 bronze badges asked Aug 30, 2017 at 17:12 netshark1000netshark1000 7,41311 gold badges65 silver badges122 bronze badges 2
  • Check this answer: stackoverflow./questions/36260839/… – Sergio Escudero Commented Aug 30, 2017 at 17:23
  • Possible duplicate of Angular 2 How to redirect to 404 or other path if the path does not exist – Kyle Krzeski Commented Aug 30, 2017 at 18:36
Add a ment  | 

1 Answer 1

Reset to default 12

The solution is very simple:

 { path: '**', ponent: NotFoundComponent }

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744576006a4581744.html

相关推荐

  • javascript - Angular: 404 page but keep url - Stack Overflow

    I wrote a custom 404 page in Angular 4 and want to keep the wrong url that was entered.You can see the

    2天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信