I am getting an error and can\'t find why. Here is the error:
EXCEPTION: Error during instantiation of LocationStrategy! (RouterOutlet -> Router -> Loc
https://angular.io/docs/ts/latest/guide/router.html
Add the base element just after the
tag. If theappfolder is the application root, as it is for our application, set thehrefvalue exactly as shown here.
The tells the Angular router what is the static part of the URL. The router then only modifies the remaining part of the URL.
...
Alternatively add
>= Angular2 RC.6
import {APP_BASE_HREF} from '@angular/common';
@NgModule({
declarations: [AppComponent],
imports: [routing /* or RouterModule */],
providers: [{provide: APP_BASE_HREF, useValue : '/' }]
]);
in your bootstrap.
In older versions the imports had to be like
< Angular2 RC.6
import {APP_BASE_HREF} from '@angular/common';
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
{provide: APP_BASE_HREF, useValue : '/' });
]);
< RC.0
import {provide} from 'angular2/core';
bootstrap(AppComponent, [
ROUTER_PROVIDERS,
provide(APP_BASE_HREF, {useValue : '/' });
]);
< beta.17
import {APP_BASE_HREF} from 'angular2/router';
>= beta.17
import {APP_BASE_HREF} from 'angular2/platform/common';
See also Location and HashLocationStrategy stopped working in beta.16