Skip to content

Commit

Permalink
only create scroller when enabled
Browse files Browse the repository at this point in the history
only call setup when disabled = false

Note: I haven't tested this yet, but putting it here for review
  • Loading branch information
dylan-smith committed Nov 19, 2017
1 parent 2d33953 commit 88a3b21
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/modules/infinite-scroll.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ export class InfiniteScrollDirective
constructor(private element: ElementRef, private zone: NgZone) {}

ngAfterViewInit() {
this.setup();
if (!this.infiniteScrollDisabled) {
this.setup();
}
}

ngOnChanges({ infiniteScrollContainer, infiniteScrollDisabled }: SimpleChanges) {
if (inputPropChanged(infiniteScrollContainer) || inputPropChanged(infiniteScrollDisabled)) {
this.destroyScroller();
this.setup();

if ((!inputPropChanged(infiniteScrollDisabled) && !this.infiniteScrollDisabled)) ||
(inputPropChanged(infiniteScrollDisabled) && !infiniteScrollDisabled.currentValue)) {
this.setup();
}
}
}

Expand Down

0 comments on commit 88a3b21

Please sign in to comment.