Skip to content

Commit

Permalink
fix: perform setup by default if user don't specify it
Browse files Browse the repository at this point in the history
  • Loading branch information
e-cloud authored and jkuri committed Jul 16, 2018
1 parent ef8978c commit 1739060
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/ngx-slimscroll/directives/slimscroll.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
HostListener,
OnChanges,
OnDestroy,
OnInit,
Renderer2,
Inject,
Optional,
Expand Down Expand Up @@ -39,7 +40,7 @@ export const easing: { [key: string]: Function } = {
selector: '[slimScroll]', // tslint:disable-line
exportAs: 'slimScroll'
})
export class SlimScrollDirective implements OnChanges, OnDestroy {
export class SlimScrollDirective implements OnInit, OnChanges, OnDestroy {
@Input() enabled = true;
@Input() options: SlimScrollOptions;
@Input() scrollEvents: EventEmitter<ISlimScrollEvent>;
Expand Down Expand Up @@ -71,6 +72,13 @@ export class SlimScrollDirective implements OnChanges, OnDestroy {
this.mutationThrottleTimeout = 50;
}

ngOnInit() {
// setup if no changes for enabled for the first time
if (!this.interactionSubscriptions && this.enabled) {
this.setup();
}
}

ngOnChanges(changes: SimpleChanges) {
if (changes.enabled) {
if (this.enabled) {
Expand Down

0 comments on commit 1739060

Please sign in to comment.