Ngx meta.withngxmetabaseurl
Home > @davidlj95/ngx-meta > withNgxMetaBaseUrl
withNgxMetaBaseUrl() function
Provides a base URL to enable resolving relative URLs. Including relative URLs provided by Angular's router.
Metadata values requiring absolute URLs may accept relative URLs then. Internally, the library will turn the relative URL into an absolute URL using the base URL as prefix.
The special value ANGULAR_ROUTER_URL can be used to query the Angular's router URL to be used as relative URL. Which with the feature enabled will be resolved into an absolute URL. Do not use the value if the feature isn't enabled. Otherwise, an invalid URL may end up used as metadata value.
Signature:
withNgxMetaBaseUrl: (baseUrl: BaseUrl) => CoreFeature<CoreFeatureKind.BaseUrl>
Parameters
Parameter | Type | Description |
---|---|---|
baseUrl | BaseUrl | Prefix URL to use when relative URLs are used in metadata values where an absolute URL is preferred or required. |
Returns:
CoreFeature<CoreFeatureKind.BaseUrl>
Example
Using standalone, recommended API
provideNgxMetaCore(
withNgxMetaBaseUrl('https://example.com')
)
NgxMetaCoreModule.forRoot(
withNgxMetaBaseUrl('https://example.com')
)
-
provideNgxMetaCore(): to use it with the standalone, recommended API.
-
NgxMetaCoreModule.forRoot(): to use it with the module-based API.