user8602819
user8602819

Reputation:

Page not found - Angular 4

Does anybody have an idea how to redirect to another url when a page is not found in Angular 4, because { path: "**", redirectTo: "/error" }, seems to be not working (at least for me)?

Upvotes: 0

Views: 388

Answers (1)

JayDeeEss
JayDeeEss

Reputation: 1083

make sure you have route defined for path "error" in your routes configuration, if yes add pathMatch: 'full' to the definition as well

{ path: "error",  component: ErrorComponent  },
{ path: "**",  redirectTo: "/error", pathMatch: 'full'  }

Upvotes: 1

Related Questions