Skip to content

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 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: 'foo'
})
But rest of metadata would be removed

To only set the title, you can use this API:

this.ngxMetaService.setOne('title', 'foo')
For more information check the service guide docs