Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-infinite-scroll

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-infinite-scroll - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "angular2-infinite-scroll",
"version": "0.1.1",
"version": "0.1.2",
"description": "An infinite scroll directive for angular2",

@@ -5,0 +5,0 @@ "main": "angular2-infinite-scroll.js",

@@ -7,16 +7,18 @@ # Angular 2 Infinite Scroll

Currently supported attributes:
* (number) "infiniteDcrollDistance" (optional, default: **2**) - should get a number
* (number) "infiniteScrollThrottle" (optional, default: **300**) - should get a number of milliseconds for throttle
* (function) - instead of defining a callback function on the "infinite-scroll" attribute, you should use the event binding **(scrolled)="handleScrollCallback()"**
* (boolean) - "scrollWindow" (optional, default: **true**) - listens to the window scroll instead of the actual element scroll. this allows to invoke a callback function in the scope of the element while listenning to the window scroll.
* (boolean) - "immediateCheck" (optional, default: **false**) - invokes the handler immediately to check if a scroll event has been already triggred when the page has been loaded (i.e. - when you refresh a page that has been scrolled).
* (number) "infiniteScrollDistance" (optional, default: **2**) - should get a number
* (number) "infiniteScrollUpDistance" (optional, default: **1.5**) - should get a number
* (number) "infiniteScrollThrottle" (optional, default: **300**) - should get a number of milliseconds for throttle
* (function) - instead of defining a callback function on the "infinite-scroll" attribute, you should use the event binding **(scrolled)="handleScrollDownCallback()"** - this will callback if the distance threshold has been reached on a scroll down.
* (function) - instead of defining a callback function on the "infinite-scroll" attribute, you should use the event binding **(scrolledUp)="handleScrollUpCallback()"** - this will callback if the distance threshold has been reached on a scroll up.
* (boolean) - "scrollWindow" (optional, default: **true**) - listens to the window scroll instead of the actual element scroll. this allows to invoke a callback function in the scope of the element while listenning to the window scroll.
* (boolean) - "immediateCheck" (optional, default: **false**) - invokes the handler immediately to check if a scroll event has been already triggred when the page has been loaded (i.e. - when you refresh a page that has been scrolled).
## Behavior
By default, the directive listens to a window scroll event and invoked the callback.
**To trigger the callback when the actual element is scrolled**, these settings should be configured:
* [scrollWindow]="false"
By default, the directive listens to a window scroll event and invoked the callback.
**To trigger the callback when the actual element is scrolled**, these settings should be configured:
* [scrollWindow]="false"
* set an explict css "height" value to the element
## Usage
In this example, the **onScroll** callback will be invoked when the window is scrolled:
In this example, the **onScroll** callback will be invoked when the window is scrolled down:

@@ -45,3 +47,3 @@ ```typescript

```
in this example, whenever the "search-results" is scrolled, the callback will be invoked:
in this example, whenever the "search-results" is scrolled, the callback will be invoked:

@@ -76,5 +78,36 @@ ```typescript

}
```
```
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:
```typescript
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 App {
onScrollDown () {
console.log('scrolled down!!')
}
onScrollUp () {
console.log('scrolled up!!')
}
}
```
# Showcase Examples
* [Echoes Player Ng2 Version](http://orizens.github.io/echoes-ng2) ([github repo for echoes player](http://github.com/orizens/echoes-ng2))

@@ -139,2 +139,1 @@ "use strict";

exports.Scroller = Scroller;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzY3JvbGxlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsbUJBQXlDLFNBQVMsQ0FBQyxDQUFBO0FBRW5EO0lBWUMsa0JBQ1MsYUFBd0MsRUFDeEMsU0FBbUIsRUFDbkIsV0FBdUIsRUFDdkIsc0JBQWdDLEVBQ3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Nyb2xsRW5hYmxlZCA9ICFlbmFibGVTY3JvbGw7XG5cdFx0Ly8gaWYgKHRoaXMuc2Nyb2xsRW5hYmxlZCAmJiBjaGVja1doZW5FbmFibGVkKSB7XG5cdFx0Ly8gXHRjaGVja1doZW5FbmFibGVkID0gZmFsc2U7XG5cdFx0Ly8gXHRyZXR1cm4gaGFuZGxlcigpO1xuXHRcdC8vIH1cblx0fVxufSJdfQ==
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc