1

I have a little Angular2 app, i have created 2 components, 'main' and 'dashboard' I have created this button to access the dashboard page:
<button md-raised-button class="md-primary" [routerLink]="['/dashboard']">Dashboard</button>
When i deploy locally with 'ng-serve' i can access the page without any problem directly: enter image description here But when i try the same in production i get a 404:
enter image description here

Accessing the dashboard page via the button link does not give me any problem, in production or development env
I have in my 'app.module.ts' the folllowing routes set: const appRoutes: Routes = [ { path: 'dashboard', component: DashboardComponent }, { path: 'table', component: MainComponent }, { path: '**', component: MainComponent } ];
In the imports then i configure the router like so:
RouterModule.forRoot(appRoutes)

And in development environment this works just fine, all code is committed and updated, i made sure i run the same code, like 5 times

JBoy
  • 5,398
  • 13
  • 61
  • 101
  • 2
    That's because your back-end doesn't have a route handler for /dashboard – eko Aug 16 '17 at 12:47
  • Check: https://stackoverflow.com/questions/35284988/angular-2-404-error-occur-when-i-refresh-through-browser, https://stackoverflow.com/questions/31415052/angular-2-0-router-not-working-on-reloading-the-browser – eko Aug 16 '17 at 12:48
  • 1
    Possible duplicate of [Angular 2 : 404 error occur when i refresh through Browser](https://stackoverflow.com/questions/35284988/angular-2-404-error-occur-when-i-refresh-through-browser) – Malik Shahzad Aug 16 '17 at 13:26

0 Answers0