Ngx meta.ngxmetaroutedata
Home > @davidlj95/ngx-meta > NgxMetaRouteData
NgxMetaRouteData interface
Utility type to ensure metadata values are set properly inside an Angular's Route.data
You can also provide specific metadata module types to ensure type safety of the metadata values. Open the API to see an example.
Signature:
export interface NgxMetaRouteData<Metadata = MetadataValues>
Remarks
If you don't specify a metadata values type, no type safety will be enforced
const routeData: NgxMetaRouteData = {
meta: { invalid: 'values' }
}
Example
With Typescript's satisfies operator and specifying GlobalMetadata and StandardMetadata
const routes: Routes = [
{
// regular route stuff
data: {
meta: { title: 'Foo', standard: { keywords: ['foo', 'bar'] } }
} satisfies NgxMetaRouteData<GlobalMetadata>
}
]
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
meta | Metadata |