APP_BASE_HREF

Stable Const

Variable Export

export APP_BASE_HREF

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

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.

Example

1
2
3
4
5
6
7
import {Component, NgModule} from '@angular/core';
import {APP_BASE_HREF} from '@angular/common';
 
@NgModule({
  providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
})
class AppModule {}

exported from @angular/common/index defined in @angular/common/src/location/location_strategy.ts

doc_Angular
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.