ngx-in-view
Angular 2+ wrapper for in-view.js
https://ihym.github.io/ngx-in-view/
Installation
Install through npm
:
npm install --save ngx-in-view
API
[inView]
Output
- enter: EventEmitter
<any>
: Emits whenever the element enters the viewport. - exit: EventEmitter
<any>
: Emits whenever the element exits the viewport. - enterOnce: EventEmitter
<any>
: Emits when the element enters the viewport for the first time. - exitOnce: EventEmitter
<any>
: Emits when the element exits the viewport for the first time.
Note: For every output, if not bound, no handler will be registered for the respective events.
Export (inView)
- is(): Check if element is in the viewport.
Usage
Once installed you need to import our main module into your application module by calling InViewModule.forRoot(). You should end up with code similar to this:
;; @ {}
Configuration
Optionally, you can pass an object to the forRoot method, to configure ngx-in-view during the initialization of the application, in order to provide your own default values. For example:
@ {}
Currently available options can be found here.
If you want to change some config properties during runtime, you can easily achieve it by utilizing the update method like this:
; {} { thisconfig; }
MIT @ Vasilis Diakomanolis