@ynmstudio/utils
Version:
YNM Utilities for Angular
56 lines (55 loc) • 1.92 kB
TypeScript
import { QueryList, AfterViewInit, OnDestroy } from '@angular/core';
import { ScrollSpyItemDirective } from '../scroll-spy-item/scroll-spy-item.directive';
import { ScrollSpyService } from '../scroll-spy-service/scroll-spy.service';
import * as i0 from "@angular/core";
/**
* Adds `active` class to navigation links when section is in the viewport.
* Used in conjuction with `snScrollItem` directive which should be added
* to anchor links in the nav
*
* @example
* ```
* <ul role="navigation" snScrollSpy id="foo">
* <li><a snScrollSpyItem for="foo" href="#section1">Section 1</a></li>
* <li><a snScrollSpyItem for="foo" href="#section2">Section 2</a></li>
* <li><a snScrollSpyItem for="foo" href="#section3">Section 3</a></li>
* <li><a snScrollSpyItem for="foo" href="#section4">Section 4</a></li>
* </ul>
* ```
*
*/
export declare class ScrollSpyDirective implements AfterViewInit, OnDestroy {
private scrollSpySvc;
/**
* Collection of `ScrollSpyItem`. They are the list of
* nav items.
*
* @memberof ScrollSpyDirective
*/
items: QueryList<ScrollSpyItemDirective>;
/**
* ID of scrollSpy instance
*
* @memberof ScrollSpyDirective
*/
id: string;
/**
* Creates an instance of ScrollSpyDirective.
* @memberof ScrollSpyDirective
*/
constructor(scrollSpySvc: ScrollSpyService);
/**
* Adds spy to list of spys in `ScrollSpyService`
*
* @memberof ScrollSpyDirective
*/
ngAfterViewInit(): void;
/**
* Remove spy from list of spys when directive is destroyed
*
* @memberof ScrollSpyDirective
*/
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollSpyDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollSpyDirective, "[snScrollSpy]", never, { "id": { "alias": "id"; "required": false; }; }, {}, ["items"], never, true, never>;
}