{
  "id": "api/common/APP_BASE_HREF",
  "title": "APP_BASE_HREF",
  "contents": "\n\n<article>\n  <div class=\"breadcrumb-container\">\n    <div class=\"breadcrumb\">\n      <script type=\"application/ld+json\">\n        {\n          \"@context\": \"http://schema.org\",\n          \"@type\": \"BreadcrumbList\",\n          \"itemListElement\": [\n            { \"@type\": \"ListItem\", \"position\": 1, \"item\": { \"@id\": \"https://angular.io//api\", \"name\": \"API\" } },\n            { \"@type\": \"ListItem\", \"position\": 2, \"item\": { \"@id\": \"https://angular.io/api/common\", \"name\": \"@angular/common\" } },\n            { \"@type\": \"ListItem\", \"position\": 3, \"item\": { \"@id\": \"https://angular.io/api/common/APP_BASE_HREF\", \"name\": \"APP_BASE_HREF\" } }\n          ]\n        }\n      </script>\n        <a href=\"/api\">API</a> > <a href=\"api/common\">@angular/common</a>\n    </div>\n    <div class=\"github-links\">\n  <a href=\"https://github.com/angular/angular/edit/master/packages/common/src/location/location_strategy.ts?message=docs(common)%3A%20describe%20your%20change...#L75-L74\" aria-label=\"Suggest Edits\" title=\"Suggest Edits\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">mode_edit</i></a>\n  <a href=\"https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/src/location/location_strategy.ts#L75-L74\" aria-label=\"View Source\" title=\"View Source\"><i class=\"material-icons\" aria-hidden=\"true\" role=\"img\">code</i></a>\n</div>\n  </div>\n  \n  <header class=\"api-header\">\n    <h1 id=\"app_base_href\">APP_BASE_HREF<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/APP_BASE_HREF#app_base_href\"><i class=\"material-icons\">link</i></a></h1>\n    \n    <label class=\"api-type-label const\">const</label>\n    \n    \n    \n  </header>\n  \n  <aio-toc class=\"embedded\"></aio-toc>\n\n  <div class=\"api-body\">\n    \n  <section class=\"short-description\">\n    <p>A predefined <a href=\"guide/glossary#di-token\">DI token</a> for the base href\nto be used with the <code><a href=\"api/common/PathLocationStrategy\" class=\"code-anchor\">PathLocationStrategy</a></code>.\nThe base href is the URL prefix that should be preserved when generating\nand recognizing URLs.</p>\n\n    \n  </section>\n  \n  \n  \n  <code-example language=\"ts\" hidecopy=\"true\" class=\"no-box api-heading\">\n  const <a href=\"api/common/APP_BASE_HREF\" class=\"code-anchor\">APP_BASE_HREF</a>: <a href=\"api/core/InjectionToken\" class=\"code-anchor\">InjectionToken</a>&#x3C;string>;\n  </code-example>\n\n  \n\n  \n  \n\n  \n<section class=\"usage-notes\">\n  <h2 id=\"usage-notes\">Usage notes<a title=\"Link to this heading\" class=\"header-link\" aria-hidden=\"true\" href=\"api/common/APP_BASE_HREF#usage-notes\"><i class=\"material-icons\">link</i></a></h2>\n  <p>The following example shows how to use this token to configure the root app injector\nwith a base href value, so that the DI framework can supply the dependency anywhere in the app.</p>\n<code-example language=\"typescript\">\nimport {<a href=\"api/core/Component\" class=\"code-anchor\">Component</a>, <a href=\"api/core/NgModule\" class=\"code-anchor\">NgModule</a>} from '@angular/core';\nimport {<a href=\"api/common/APP_BASE_HREF\" class=\"code-anchor\">APP_BASE_HREF</a>} from '@angular/common';\n\n@<a href=\"api/core/NgModule\" class=\"code-anchor\">NgModule</a>({\n  providers: [{provide: <a href=\"api/common/APP_BASE_HREF\" class=\"code-anchor\">APP_BASE_HREF</a>, useValue: '/my/app'}]\n})\nclass AppModule {}\n</code-example>\n\n</section>\n\n\n\n  </div>\n</article>\n\n<!-- links to this doc:\n - api/common\n - api/common/Location\n - api/common/PathLocationStrategy\n - guide/deployment\n - guide/ivy\n - guide/router\n - guide/universal\n - guide/upgrade\n-->\n<!-- links from this doc:\n - /api\n - api/common\n - api/common/APP_BASE_HREF#app_base_href\n - api/common/APP_BASE_HREF#usage-notes\n - api/common/PathLocationStrategy\n - api/core/Component\n - api/core/InjectionToken\n - api/core/NgModule\n - guide/glossary#di-token\n - https://github.com/angular/angular/edit/master/packages/common/src/location/location_strategy.ts?message=docs(common)%3A%20describe%20your%20change...#L75-L74\n - https://github.com/angular/angular/tree/12.0.0-next.7/packages/common/src/location/location_strategy.ts#L75-L74\n-->"
}