1

I built the project using angular-cli.
My routes look like this:

  export const routes: RouterConfig = [
    { path: 'users', component: UsersComponent, canActivate: [AuthGuard] },   
    { path: 'users/new', component: NewUsersComponent, canActivate: [AuthGuard]  },   
    { path: 'users/edit', component: EditUsersComponent, canActivate: [AuthGuard]  },         
  ];

  export const APP_ROUTER_PROVIDERS = [
    provideRouter(routes),
    AuthGuard
  ];

If i refresh the page in http://localhost:4200/users there are no problems.

If i hit refresh page in http://localhost:4200/users/new or in http://localhost:4200/users/edit , i get a world of Erros:

GET http://localhost:4200/users/assets/css/styles.css 
new:31 GET http://localhost:4200/users/vendor/es6-shim/es6-shim.js 
new:31 GET http://localhost:4200/users/vendor/reflect-metadata/Reflect.js 
new:31 GET http://localhost:4200/users/vendor/zone.js/dist/zone.js 
.... etc....

Otherwise the app works fine.
Why is this happening and how can i fix it?

Cristian Muscalu
  • 9,007
  • 12
  • 44
  • 76

0 Answers0