Skip to content

Ngx meta.ngxmetaelementsservice

Home > @davidlj95/ngx-meta > NgxMetaElementsService

NgxMetaElementsService class

Manages <meta> elements inside <head>

Signature:

export declare class NgxMetaElementsService 

Constructors

Constructor Modifiers Description
(constructor)(meta) Constructs a new instance of the NgxMetaElementsService class

Methods

Method Modifiers Description
set(nameAttribute, content)

Creates, updates or removes some kind of <meta> elements inside <head> in a declarative fashion.

API is in alpha state. But appears as beta due a tooling limitation

Kind of <meta> elements to manage are identified by an HTML attribute providing its metadata name. For instance, to manage description metadata elements (<meta name="description">) on the page, the name attribute with description value identifies them.

Then, contents for those can be specified. In the shape of a key/value JSON object declaring each element's additional attributes. Mainly content named attributes. See NgxMetaElementAttributes. If no contents are provided, all <meta> elements of that kind will be removed. An array of contents may be given to create multiple <meta> elements with same kind.