Reputation: 925
I want to use hash in angular routes. I tried to find but all examples are for oldest version. Any suggestion how can i do that?
I tried this:
let injector = ReflectiveInjector.resolveAndCreate(NgModule);
let http = injector.get(Http);
let authService = new AuthService(new LocalStorage(), http);
providers: [ {provide:AuthService,useValue:authService}, // over here
SharedService,DatePipe],
But im getting error:
Can not find local storage, can not find AuthService and i can not use NgModule in ReflectiveIncjector.
Any suggestion how can i use hashbang?
Upvotes: 0
Views: 3430
Reputation: 40647
In your @NgModule
you use useHash:true
:
imports: [
RouterModule.forRoot([
...
]
,{ useHash: true }
)],
Source: https://angular.io/docs/ts/latest/guide/router.html#!#-hashlocationstrategy-
Upvotes: 7