Angular 2: 404 error occur when I refresh through the browser [duplicate]


https://stackoverflow.com/questions/35284988/angular-2-404-error-occur-when-i-refresh-through-the-browser


#前端#


修改app.module.ts


import { HashLocationStrategy, LocationStrategy } from '@angular/common';


providers: [
         { provide: LocationStrategy, useClass: HashLocationStrategy }
   ],


修改root-routing.module.ts


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