@@ -348,13 +348,13 @@ export class IgxTestScrollInertiaDirective extends IgxScrollInertiaDirective {
348348 <div #container style='width:calc(100% - 50px); height: 500px; float: left;'>
349349 <ng-template igxTestScrollInertia #scrInertiaContainer></ng-template>
350350 </div>
351- <div #scrBar [style.height]='height' style='overflow: auto; width: 50px; float:right;'>
351+ <div #scrBar [style.height]='height' style='overflow: auto; width: 50px; float:right;' (scroll)="this.onScroll($event)" >
352352 <div [style.height]='innerHeight' [style.width]='innerWidth'></div>
353353 </div>
354354 ` ,
355355 imports : [ IgxTestScrollInertiaDirective ]
356356} )
357- export class ScrollInertiaComponent implements OnInit , OnDestroy {
357+ export class ScrollInertiaComponent implements OnInit {
358358 @ViewChild ( 'container' , { static : true } ) public container : ElementRef ;
359359 @ViewChild ( 'scrBar' , { static : true } ) public scrollContainer : ElementRef ;
360360 @ViewChild ( 'scrInertiaContainer' , { read : IgxTestScrollInertiaDirective , static : true } )
@@ -370,9 +370,6 @@ export class ScrollInertiaComponent implements OnInit, OnDestroy {
370370
371371 public ngOnInit ( ) {
372372 this . scrInertiaDir . IgxScrollInertiaScrollContainer = this . scrollContainer . nativeElement ;
373-
374- this . onScroll = this . onScroll . bind ( this ) ;
375- this . scrollContainer . nativeElement . addEventListener ( 'scroll' , this . onScroll ) ;
376373 }
377374
378375 public onScroll ( evt ) {
@@ -386,8 +383,4 @@ export class ScrollInertiaComponent implements OnInit, OnDestroy {
386383 this . scrTopStepArray . push ( calcScrollStep ) ;
387384 this . scrLeftStepArray . push ( calcScrollLeftStep ) ;
388385 }
389-
390- public ngOnDestroy ( ) : void {
391- this . scrollContainer . nativeElement . removeEventListener ( 'scroll' , this . onScroll ) ;
392- }
393386}
0 commit comments