Date de création : 2020/12/14 10:20
Cette page a pour source partielle ou intégrale la ou les page(s) suivante(s):
If you are using angular 6,7 this method works (If you are okay with /#/ in your URL.
In
app.module.ts
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
After import add following line to providers.
{provide: LocationStrategy, useClass: HashLocationStrategy}
ex:
providers: [AuthService, AuthGuard, FlxUiDataTable, {provide: LocationStrategy, useClass: HashLocationStrategy}]
ou la méthode donnée sur le site de Anuglar:
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { Routes, RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; import { PageNotFoundComponent } from './page-not-found/page-not-found.component'; const routes: Routes = [ ]; @NgModule({ imports: [ BrowserModule, FormsModule, RouterModule.forRoot(routes, { useHash: true }) // .../#/crisis-center/ ], declarations: [ AppComponent, PageNotFoundComponent ], providers: [ ], bootstrap: [ AppComponent ] }) export class AppModule { }
Page dans la catégorie: