In previous rc.4 release setting up hashbang #! looked like this
bootstrap(ApplicationComponent, [....
{provide: LocationStrategy, useClass: HashLocationStrategy},
{provide: APP_BASE_HREF, useValue: '!'}
]);
Now in rc.5 everything got changed a litte bit and I struggle to find a way to have same address containing #!
Angular docs are quite clear about setting up routing but hashbang is somewhat skipped in tha description(https://angular.io/docs/ts/latest/guide/router.html) . Setting up hash alone is done like so in rc.5 app.routing.ts
export const routing = RouterModule.forRoot(appRoutes, { useHash: true });
however not sure how to additionally define "!" in url in rc.5
I am not sure how it should be applied and in what form. Perhaps in boostrap:... inside @NgModule in app.module but so far I did not make it work. Please suggest.
you can do it like this in app.module.ts
file by adding it in providers
array
import {ReflectiveInjector} from '@angular/core';
import { Http, Response, Request, HTTP_PROVIDERS } from '@angular/http';
let injector = ReflectiveInjector.resolveAndCreate(HTTP_PROVIDERS);
let http = injector.get(Http);
let authService = new AuthService(new LocalStorage(), http);
@NgModule({
imports: [
BrowserModule,
FormsModule,
routing,
],
declarations: [
AppComponent,
MyComponent,
],
bootstrap: [
AppComponent
],
providers: [
{provide:AuthService,useValue:authService}, // over here
AdminAuthGuard,
UserAuthGuard
]
})