1

I've recently built an app using angular 4 in production flag --prod.

It gave me some static files in the dist folder and after that I've uploaded the dist files in AWS S3 bucket. It all went fine until I clicked refresh. While clicking refresh on other routes like /page1 or /page2 it is showing '404 not found' no such key error.

Am I doing anything wrong here? I know the problem exists because there is only one file (index.html) in the dist folder. But what about other routes?

How could I make other pages available even after refreshing the page.

Sébastien
  • 11,860
  • 11
  • 58
  • 78
VinoPravin
  • 947
  • 3
  • 17
  • 32

2 Answers2

0

You must be configured NGINX for angular 2 routing.

Link

Check Answer this.

Hope so it helps you.

Ashish Kadam
  • 1,439
  • 2
  • 13
  • 18
0

You have to do define default routing in your app-route file and add the second parameter in RouterModule like that

@NgModule({
  imports: [RouterModule.forRoot(routes, { useHash: true })],
  exports: [RouterModule]
})

it's working for me