Ngx meta.ngxmetaservice.setone
Home > @davidlj95/ngx-meta > NgxMetaService > setOne
NgxMetaService.setOne() method
Sets a metadata value for the page
You can specify which metadata elements will be changed by using the global or JSON Path that you would use if using NgxMetaService.set() API
Signature:
setOne(globalOrJsonPath: string, value: unknown): void;
Parameters
Parameter | Type | Description |
---|---|---|
globalOrJsonPath | string | Looks for metadata managers whose global matches this argument. Or whose JSON path matches this argument. |
value | unknown | Value to set for matching metadata elements |
Returns:
void
Remarks
For instance, if you want to just set the title of the page. You'd set it with NgxMetaService.set() API like this:
this.ngxMetaService.set({
title: 'Global title'
standard: {
title: 'Standard title',
}
})
To only set the title
, you can use this API:
this.ngxMetaService.setOne('title', 'Global title')
this.ngxMetaService.setOne('standard.title', 'Standard title')