angular2-infinite-scroll
Advanced tools
Comparing version 0.2.0-0 to 0.2.0-1
{ | ||
"name": "angular2-infinite-scroll", | ||
"version": "0.2.0-0", | ||
"version": "0.2.0-1", | ||
"description": "An infinite scroll directive for angular2", | ||
@@ -37,2 +37,5 @@ "main": "angular2-infinite-scroll.js", | ||
"@angular/platform-browser-dynamic": "2.0.0-rc.5", | ||
"@types/core-js": "^0.9.32", | ||
"@types/jasmine": "^2.2.33", | ||
"@types/node": "^6.0.38", | ||
"autodts": "0.0.6", | ||
@@ -39,0 +42,0 @@ "es6-promise": "^3.0.2", |
@@ -6,2 +6,5 @@ [![Build Status](https://travis-ci.org/orizens/angular2-infinite-scroll.svg?branch=master)](https://travis-ci.org/orizens/angular2-infinite-scroll) | ||
## Angular 2 Support | ||
Updated to support Angular 2 - **RC.5** | ||
## Installation | ||
@@ -13,7 +16,6 @@ ``` | ||
## Supported API | ||
The directive triggers | ||
Currently supported attributes: | ||
* (number) "infiniteScrollDistance" (optional, default: **2**) - should get a number, the number of viewport lenghts from the bottom of the page at which the event will be triggered. | ||
* (number) "infiniteScrollUpDistance" (optional, default: **1.5**) - should get a number | ||
* (number) "infiniteScrollThrottle" (optional, default: **300**) - should get a number of milliseconds for throttle. The event will be triggered this many milliseconds after the user *stops* scrolling. | ||
* (number) "infiniteScrollThrottle" (optional, default: **300**) - should get a number of **milliseconds** for throttle. The event will be triggered this many milliseconds after the user *stops* scrolling. | ||
* (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. | ||
@@ -28,7 +30,28 @@ * (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. | ||
**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 | ||
* [scrollWindow]="false" | ||
* set an explict css "height" value to the element | ||
## DEMO | ||
[See a live example at this plunkr](https://plnkr.co/edit/DrEDetYnZkFxR7OWWrxS?p=preview) | ||
## Usage | ||
[See a live example at this plunkr](https://plnkr.co/edit/DrEDetYnZkFxR7OWWrxS?p=preview) | ||
First, import the InfiniteScrollModule to your module: | ||
```typescript | ||
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: | ||
@@ -38,7 +61,5 @@ | ||
import { Component } from '@angular/core'; | ||
import { InfiniteScroll } from 'angular2-infinite-scroll'; | ||
@Component({ | ||
selector: 'app', | ||
directives: [ InfiniteScroll ], | ||
template: ` | ||
@@ -53,3 +74,3 @@ <div class="search-results" | ||
}) | ||
export class App { | ||
export class AppComponent { | ||
onScroll () { | ||
@@ -64,7 +85,5 @@ console.log('scrolled!!') | ||
import { Component } from '@angular/core'; | ||
import { InfiniteScroll } from 'angular2-infinite-scroll'; | ||
@Component({ | ||
selector: 'app', | ||
directives: [ InfiniteScroll ], | ||
styles: [ | ||
@@ -86,3 +105,3 @@ `.search-results { | ||
}) | ||
export class App { | ||
export class AppComponent { | ||
onScroll () { | ||
@@ -114,3 +133,3 @@ console.log('scrolled!!') | ||
}) | ||
export class App { | ||
export class AppComponent { | ||
onScrollDown () { | ||
@@ -117,0 +136,0 @@ console.log('scrolled down!!') |
@@ -0,1 +1,2 @@ | ||
/// <reference types="core-js" /> | ||
import { ElementRef } from '@angular/core'; | ||
@@ -2,0 +3,0 @@ import { AxisResolver } from './axis-resolver'; |
@@ -12,3 +12,9 @@ { | ||
"noImplicitAny": true, | ||
"suppressImplicitAnyIndexErrors": true | ||
"noEmitOnError": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"types": [ | ||
"core-js", | ||
"jasmine", | ||
"node" | ||
] | ||
}, | ||
@@ -24,3 +30,3 @@ "exclude": [ | ||
"files": [ | ||
"../typings/index.d.ts", | ||
// "../typings/index.d.ts", | ||
"./infinite-scroll.ts", | ||
@@ -27,0 +33,0 @@ "./infinite-scroll.spec.ts", |
{ | ||
"compilerOptions": { | ||
"noEmitOnError": true, | ||
"noImplicitAny": true, | ||
@@ -12,3 +13,8 @@ "module": "commonjs", | ||
"suppressImplicitAnyIndexErrors": true, | ||
"moduleResolution": "node" | ||
"moduleResolution": "node", | ||
"types": [ | ||
"core-js", | ||
"jasmine", | ||
"node" | ||
] | ||
}, | ||
@@ -23,3 +29,3 @@ "exclude": [ | ||
"files": [ | ||
"./typings/index.d.ts", | ||
// "./typings/index.d.ts", | ||
"./angular2-infinite-scroll.ts", | ||
@@ -26,0 +32,0 @@ "./src/infinite-scroll.ts", |
@@ -5,6 +5,6 @@ { | ||
"globalDependencies": { | ||
"core-js": "registry:dt/core-js#0.0.0+20160602141332", | ||
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446", | ||
"node": "registry:dt/node#6.0.0+20160613154055" | ||
"core-js": "registry:dt/core-js#0.0.0+20160725163759", | ||
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255", | ||
"node": "registry:dt/node#6.0.0+20160823142437" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
149
100061
29
24
1228
1