Ngx meta.ngxmetaroutedata
Home > @davidlj95/ngx-meta > NgxMetaRouteData
NgxMetaRouteData interface
Utility type to ensure metadata values are set properly inside an Angular `Route.data`
You can also provide specific metadata module types to ensure type safety of the metadata values. Open doc details 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 types
const routes: Routes = [
{
// regular route stuff
data: {
meta: { title: 'Foo', standard: { keywords: ['foo', 'bar'] } }
} satisfies NgxMetaRouteData<GlobalMetadata & StandardMetadata>
}
]
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
meta | Metadata |