Build your project using the latest version of angular-cli, they changed the build system between beta 10 and beta 14, from SystemJS to Webpack.
Use the LocationStrategy and HashLocationStrategy classes in app.module.ts , as shown in the code example below. It will solve your update problem on any specific route when deploying the application to any HTTP server such as (nginx).
After adding these classes to the providers section, run ng serve , and the root of your application will look like http://localhost:4200/#/ in the browser.
import { NgModule } from '@angular/core'; import { HttpModule } from '@angular/http'; import { LocationStrategy, HashLocationStrategy } from '@angular/common'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent, ... ], imports: [ HttpModule, RouterModule, ... ], providers: [ ..., {provide: LocationStrategy, useClass: HashLocationStrategy} ], bootstrap: [AppComponent] }) export class AppModule { }
When you update, it restarts in the right place.
Also check out the Angular 2.0 router that doesn't work when you restart your browser to find out more.
Hope this helps!
source share