File

projects/ngx-observers/src/lib/mutation.directive.ts

Description

MutationDirective

Allow observe DOM tree changes

Example:

<div (obsMutation)="mutate($event)" [obsOptions]="{subtree: false}" #elem="directive">...</div>

Implements

OnInit OnDestroy

Metadata

Index

Properties
Inputs
Outputs

Inputs

obsOptions
Type : MutationObserverInit
Default value : {}

Observer options input

You can pass original observer options via [obsOptions] input, to configure observer behaviour.

Detailed information can be found: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe

Outputs

obsMutation
Type : EventEmitter

obsMutation output

Emits array of MutationRecord objects, describing each change that occurred.

Detailed information can be found: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver

Properties

observer
Type : MutationObserver | undefined

Original observer object

You can access observer within your controller using @ViewChild

Example:

@ViewChild('elem') obsMutation: MutationDirective | undefined; // elem is variable from template (#elem="directive")

Detailed information can be found: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver

results matching ""

    No results matching ""