Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
angular2-infinite-scroll
Advanced tools
Inspired by ng-infinite-scroll directive for angular (> 2).
Supports in Angular > +2, 4
I'm a Senior Javascript Engineer & A Front End Consultant at Orizens. My services include:
npm install angular2-infinite-scroll --save
Currently supported attributes:
By default, the directive listens to the window scroll event and invoked the callback.
To trigger the callback when the actual element is scrolled, these settings should be configured:
First, import the InfiniteScrollModule to your module:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { InfiniteScrollModule } from 'angular2-infinite-scroll';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app';
@NgModule({
imports:[ BrowserModule, InfiniteScrollModule ],
declarations: [ AppComponent, ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
platformBrowserDynamic().bootstrapModule(AppModule);
In this example, the onScroll callback will be invoked when the window is scrolled down:
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: `
<div class="search-results"
infinite-scroll
[infiniteScrollDistance]="2"
[infiniteScrollThrottle]="300"
(scrolled)="onScroll()">
</div>
`
})
export class AppComponent {
onScroll () {
console.log('scrolled!!')
}
}
in this example, whenever the "search-results" is scrolled, the callback will be invoked:
import { Component } from '@angular/core';
@Component({
selector: 'app',
styles: [
`.search-results {
height: 20rem;
overflow: scroll;
}`
],
template: `
<div class="search-results"
infinite-scroll
[infiniteScrollDistance]="2"
[infiniteScrollThrottle]="500"
(scrolled)="onScroll()"
[scrollWindow]="false">
</div>
`
})
export class AppComponent {
onScroll () {
console.log('scrolled!!')
}
}
In this example, the onScrollDown callback will be invoked when the window is scrolled down and the onScrollUp callback will be invoked when the window is scrolled up:
import { Component } from '@angular/core';
import { InfiniteScroll } from 'angular2-infinite-scroll';
@Component({
selector: 'app',
directives: [ InfiniteScroll ],
template: `
<div class="search-results"
infinite-scroll
[infiniteScrollDistance]="2"
[infiniteScrollUpDistance]="1.5"
[infiniteScrollThrottle]="500"
(scrolled)="onScrollDown()"
(scrolledUp)="onScrollUp()">
</div>
`
})
export class AppComponent {
onScrollDown () {
console.log('scrolled down!!')
}
onScrollUp () {
console.log('scrolled up!!')
}
}
FAQs
An infinite scroll directive for angular2
We found that angular2-infinite-scroll demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.