Angular 2 Routing : 404 page not found on refresh

Method — 1

In app.module.ts:

  • Add imports:

And in NgMoudle provider, add:

Example (app.module.ts):

 

Method — 2

Use RouterModule.forRoot with the {useHash: true} argument.

Example:(from angular docs) (app-routing.module.ts)

If still have issue then update .htaccess file

One comment to Angular 2 Routing : 404 page not found on refresh

  • Cyprus Elpida  says:

    We love your content. Regards from Pissouri Bay Divers from Cyprus.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">