Function
applyMetaToElement
@ng-forge/dynamic-forms
Applies meta attributes to a DOM element and tracks which attributes were applied.
This utility handles: - Removing previously applied attributes that are no longer in meta - Setting new attributes from meta - Converting all values to strings via String()
Signature
function applyMetaToElement(
element: Element,
meta: FieldMeta,
previouslyApplied: Set<string>
): Set<string>Parameters
| Name | Type | Description |
|---|---|---|
element | Element | - The DOM element to apply attributes to |
meta | FieldMeta | - The meta object containing attributes to apply |
previouslyApplied | Set<string> | - Set of attribute names that were previously applied |
Returns
Set<string>
Examples
private appliedAttrs = new Set<string>();
explicitEffect([this.meta], ([meta]) => {
const input = this.el.nativeElement.querySelector('input');
if (input) {
this.appliedAttrs = applyMetaToElement(input, meta, this.appliedAttrs);
}
});packages/dynamic-forms/src/lib/utils/apply-meta.ts:28