APP_BASE_HREF

const

The APP_BASE_HREF token represents the base href to be used with the PathLocationStrategy.

See more...

const APP_BASE_HREF: InjectionToken<string>;

Description

If you're using PathLocationStrategy, you must provide a provider to a string representing the URL prefix that should be preserved when generating and recognizing URLs.

Usage notes

Example

import {Component, NgModule} from '@angular/core';
import {APP_BASE_HREF} from '@angular/common';

@NgModule({
  providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
})
class AppModule {}

© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/common/APP_BASE_HREF