Ionic 3 - add a 404 page to URL Router

2019-05-31 07:36发布

问题:

In this Question I found a answer for 404 pages in Ionic 3 Routing: Custom 404 page Ionic 3

But I have a problem in my router when I use parameters. If I add this to my router:

{ component: EventdetailsPage, name: 'Details', segment: 'event/:eventId',defaultHistory: [HomePage] },

With this line at the bottom of my config, every call to a page with parameters will redirected:

{ component: NotFoundPage, name: "*", segment: ":**", defaultHistory: [NotFoundPage] },

on every call of .../event/123 it will redirect me to the 404 page. I tried a lot of combinations like -> segment: ":"/":"

but nothing works. Where can I find a 404 page solution that works with PWA Urls in Ionic.