Skip to content

Commit e260b1d

Browse files
init scrollbar after init view
1 parent b16bb0b commit e260b1d

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@synapsium/ngx-scrollbar",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "Angular wrapper library for beautiful charts based on Chartjs",
55
"author": "https://github.com/synapsium/ngx-scrollbar/graphs/contributors",
66
"license": "MIT",

src/lib/scrollbar.directive.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Directive, ElementRef, OnInit, AfterViewInit,
1+
import { Directive, ElementRef, AfterViewInit,
22
OnDestroy, OnChanges, Optional, Inject, Renderer2, SimpleChanges, Input } from '@angular/core';
33
import { CLASSNAME } from './constants/classname';
44
import { ScrollbarConfig, SCROLLBAR_CONFIG, DEFAULT_SCROLLBAR_CONFIG } from './scrollbar.config';
@@ -13,7 +13,7 @@ import { ScrollbarContainer } from './models/scrollbar-container';
1313
@Directive({
1414
selector: '[scrollbar]'
1515
})
16-
export class ScrollbarDirective implements OnInit, AfterViewInit, OnDestroy, OnChanges {
16+
export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
1717
@Input() autoHide: boolean;
1818

1919
private _config: ScrollbarConfig;
@@ -38,10 +38,11 @@ export class ScrollbarDirective implements OnInit, AfterViewInit, OnDestroy, OnC
3838
constructor(private _element: ElementRef, private _renderer: Renderer2,
3939
@Optional() @Inject(SCROLLBAR_CONFIG) private _injectedConfig: ScrollbarConfig) { }
4040

41+
4142
/**
42-
* OnInit lifecycle.
43+
* AfterViewInit lifecycle.
4344
*/
44-
public ngOnInit(): void {
45+
ngAfterViewInit(): void {
4546
this._initConfig();
4647
this._initDOM();
4748
this._initListeners();
@@ -63,12 +64,6 @@ export class ScrollbarDirective implements OnInit, AfterViewInit, OnDestroy, OnC
6364
this._updateBarPositionUI(verticalTrackbar.axis, verticalTrackbar.bar);
6465
}
6566

66-
/**
67-
* AfterViewInit lifecycle.
68-
*/
69-
ngAfterViewInit(): void {
70-
}
71-
7267
/**
7368
* OnChanges lifecycle.
7469
* @param changes - Changes

0 commit comments

Comments
 (0)