Dart/Angular 2: Pub serve 404 on page reload Dart/Angular 2: Pub serve 404 on page reload dart dart

Dart/Angular 2: Pub serve 404 on page reload


Either add

bootstrap(AppComponent, [  /* other providers */,   provide(LocationStrategy, useClass: HashLocationStrategy),])

or use a proxy like Nginx that supports rewriting. pub itself doesn't support it in any way.

See also https://pub.dartlang.org/packages/pub_serve_rewrites


Do not use a slash on your path "/". Try this:

const userRoutes: Routes = [    { path: 'home', component: HomeComponent, pathMatch: 'full' },];