Skip to content

Ngx meta.metadataresolveroptions.objectmerge

Home > @davidlj95/ngx-meta > MetadataResolverOptions > objectMerge

MetadataResolverOptions.objectMerge property

Enables merging the metadata value when it's an object and multiple values are found

Signature:

readonly objectMerge?: boolean;

Example

Given a metadata manager whose:

Then resolving the following metadata values:

const metadataValues = {
  bar: {a: 'a', b: 'b'},
  foo: {
    bar: { b: 'B', c: 'C'}
  }
}
Would resolve to two objects (the JSON path one and the global one).

If specifying both, specific JSON path one will take preference (as mentioned in the metadata values JSON guide).

So it would resolve to { b: 'B', c: 'C' }. However, when enabling object merging, both objects resolved are merged (with specific one taking preference too). Therefore, final value resolved would be { a: 'a', b: 'B', c: 'C' }

This merging also happens when objects are found during defaults and route values resolution.