ngx-in-viewport
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

ngx-in-viewport

npm version

A simple Angular Directive to easily determine if a element in in the viewport.

Demo

Installation

To install this library, run:

npm install ngx-in-viewport --save

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgxInViewportModule } from 'ngx-in-viewport';
 
import { AppComponent } from './app.component';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxInViewportModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
 

Component

Once the library is imported, you can use the ngx-debounce-click directive.

import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
 
@Component({
  selector: 'app-root',
  template: `
  <div ngxInViewport (inViewport)="log($event)">
    Hello World!
  </div>
  `
})
export class AppComponent {
  log(event) {
    console.log(event);
  }
}

License

MIT © Cory Rylan

Readme

Keywords

none

Package Sidebar

Install

npm i ngx-in-viewport

Weekly Downloads

37

Version

0.0.2

License

MIT

Unpacked Size

30.3 kB

Total Files

15

Last publish

Collaborators

  • splintercode