@thejlifex/ngx-scroll-spy
Version:
An Angular library that can spy the position of elements (inside a scrollable container) and emit the currently active (visible) element in the viewport.
30 lines (29 loc) • 1.37 kB
TypeScript
import { OnInit, OnDestroy, ElementRef } from '@angular/core';
import { ScrollSpyService } from './scroll-spy.service';
import * as i0 from "@angular/core";
/**
* Creates a scroll-spy on this spy targets container (element).
*
* Automatically destroys the scroll-spy when the element is destroyed.
*
* This is useful:
*
* - when you have multiple (independent) scrollable elements on the same page,
* - or the scrollable element on your page is not the browser default scrollable element, for example `<mat-sidenav-content>` if you are using [Angular Material Sidenav](https://material.angular.io/components/sidenav)
*
* where you want to have a scroll-spy.
*/
export declare class SpyTargetContainerDirective implements OnInit, OnDestroy {
private scrollSpyService;
private platformId;
private elementRef;
/**
* ID for this spyTargetContainer.
*/
spyTargetContainerId: string;
constructor(scrollSpyService: ScrollSpyService, platformId: string, elementRef: ElementRef<Element>);
ngOnInit(): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<SpyTargetContainerDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<SpyTargetContainerDirective, "[spyTargetContainer]", never, { "spyTargetContainerId": "spyTargetContainerId"; }, {}, never, never, true>;
}