Skip to content

Commit

Permalink
fixes orizens#156
Browse files Browse the repository at this point in the history
  • Loading branch information
orizens committed Apr 25, 2017
1 parent 784b9dd commit b04900b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v 0.5.1 (2017/04/25)
* [FIX] - fixes #156 - running scroll logics outside of angular's zone

## v 0.5.0 (2017/04/24)
* [MAINTAINANCE] - code refactor - removing factories to rely more pure functional methods in PositionResolver, AxisResolver

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-infinite-scroll",
"version": "0.5.0",
"version": "0.5.1",
"description": "An infinite scroll directive for Angular compatible with AoT compilation and Tree shaking",
"main": "./bundles/ngx-infinite-scroll.umd.js",
"module": "./modules/ngx-infinite-scroll.es5.js",
Expand Down
26 changes: 14 additions & 12 deletions src/modules/infinite-scroll.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,21 @@ export class InfiniteScrollDirective implements OnDestroy, OnInit {

ngOnInit() {
if (typeof window !== 'undefined') {
const containerElement = this.resolveContainerElement();
const resolver = this.positionResolver.create({
axis: new AxisResolver(!this.horizontal),
windowElement: containerElement,
this.zone.runOutsideAngular(() => {
const containerElement = this.resolveContainerElement();
const resolver = this.positionResolver.create({
axis: new AxisResolver(!this.horizontal),
windowElement: containerElement,
});
const options: IScrollRegisterConfig = {
container: resolver.container,
filterBefore: () => !this.infiniteScrollDisabled,
mergeMap: () => this.positionResolver.calculatePoints(this.element, resolver),
scrollHandler: (container: IPositionStats) => this.handleOnScroll(container),
throttleDuration: this.infiniteScrollThrottle
};
this.disposeScroller = this.scrollRegister.attachEvent(options);
});
const options: IScrollRegisterConfig = {
container: resolver.container,
filterBefore: () => !this.infiniteScrollDisabled,
mergeMap: () => this.positionResolver.calculatePoints(this.element, resolver),
scrollHandler: (container: IPositionStats) => this.handleOnScroll(container),
throttleDuration: this.infiniteScrollThrottle
};
this.disposeScroller = this.scrollRegister.attachEvent(options);
}
}

Expand Down

0 comments on commit b04900b

Please sign in to comment.