I am going to develop a simple Angular 2 application. I have created a project with routing, using Angular CLI and added several components to the app using \'ng generate co
You can do it while registering your RouterModule.forRoot, you can pass a second object with propert {useHash: true} like the below :
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {appRoutes} from './app.routes';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
RouterModule.forRoot(appRoutes , {useHash: true})],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}