Im working on an angular application (Version 6) which is hosted on an AWS s3 Bucket.
There is a little #
in my app url routing which wont break my routing or isnt a problem at all. Anyway I tried to get rid of the #
with no success so far.
A little Example:
http://localhost:4200/#/Login
should be http://localhost:4200/Login
Which is the best way to get rid of the #
?
app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
// ----- Import of all the Components
...
export const routes: Routes = [
{ path: '', component: LoginComponent },
{ path: 'Login', component: LoginComponent },
{ path: 'signup', component: signupComponent },
{ path: 'Password', component: PasswordResetComponent, data: {title: 'Passwort Reset'} },
{ path: 'password', component: PasswordResetComponent, data: {title: 'Passwort Reset'} },
{ path: 'confirmation', component: LoginComponent },
{ path: 'Error', component: ErrorPageComponent, data: {title: 'ERROR'} },
export const routing = RouterModule.forRoot(routes);
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
In the app.module.ts I just import the AppRoutingModule
in your app-routing.module look for this line
RouterModule.forRoot(routes, {useHash : true}) //<= Change this boolean to false
There are currently 2 routing strategies Take a look at this separate related answer to further understand the differences