moizKachwala/Angular2-express-mongoose-gulp-node-typescript

how do i remove the '#' in the url

anjia opened this issue · 1 comments

anjia commented

I found that there must be the character '#' in the url.
eg.
i define the route like following:
{
path: 'home',
component: HomeComponent
}

but, when i click the nav 'home', the page's url showed in the url address likes this:
http://localhost:8366/#/home

If i want to remove the part '/#', and final url is 'http://localhost:8366/home'. how should i do?

looking forward your replay.

In angular there is location strategy

Look into app.module.ts where app is bootstrapped there you have

@NgModule({
.......
providers: [
....
{ provide: LocationStrategy, useClass: HashLocationStrategy },
....
]
});

And remove this part since PathLocationStrategy is default strategy