I am currently working on an Angular2 Project using TypeScript and I can't get the HashLocationStrategy to work. I override the LocationStrategy in the bootstrapping the way it is explained here: https://angular.io/docs/ts/latest/guide/router.html
import {bootstrap} from 'angular2/platform/browser';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {AppComponent} from './app.component';
// Add these symbols to override the `LocationStrategy`
import {provide} from 'angular2/core';
import {LocationStrategy,
HashLocationStrategy} from 'angular2/router';
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
provide(LocationStrategy,
{useClass: HashLocationStrategy})
]);
I have created a plunker to demonstrate my Problem here: https://plnkr.co/edit/YE5w4iky53SHRi211lqX?p=preview
Has anybody else encountered this issue? Have I misunderstood this or am I missing something?
Edit: The expected result would be that the routing uses hashes in the URL. In the example that should produce an url like this: .../#/fubar, instead I get .../fubar
To see the generated urls, you will have to run the plunker in a separate window (blue full screen button)