File

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

Description

IntersectionDirective

Allow observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport

Example:

<div (obsIntersection)="intersect($event)" [obsOptions]="{threshold: 0.5}" #elem="directive">...</div>

Implements

OnInit OnDestroy

Metadata

Index

Properties
Inputs
Outputs

Inputs

obsOptions
Type : IntersectionObserverInit
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/IntersectionObserver

Outputs

obsIntersection
Type : EventEmitter

obsIntersection output

Emits array of IntersectionObserverEntry objects, each representing one threshold which was crossed, either becoming more or less visible than the percentage specified by that threshold.

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

Properties

observer
Type : IntersectionObserver | undefined

Original observer object

You can access observer within your controller using @ViewChild

Example:

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

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

results matching ""

    No results matching ""