File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
projects/igniteui-angular/src/lib/directives/button Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ import {
99 booleanAttribute ,
1010 inject ,
1111 AfterViewInit ,
12+ OnDestroy
1213} from '@angular/core' ;
1314import { PlatformUtil } from '../../core/utils' ;
14- import { animationFrameScheduler } from 'rxjs' ;
15+ import { animationFrameScheduler , Subscription } from 'rxjs' ;
1516
1617export const IgxBaseButtonType = {
1718 Flat : 'flat' ,
@@ -21,9 +22,10 @@ export const IgxBaseButtonType = {
2122
2223
2324@Directive ( )
24- export abstract class IgxButtonBaseDirective implements AfterViewInit {
25+ export abstract class IgxButtonBaseDirective implements AfterViewInit , OnDestroy {
2526 private _platformUtil = inject ( PlatformUtil ) ;
2627 private _viewInit = false ;
28+ private _animationScheduler : Subscription ;
2729
2830 /**
2931 * Emitted when the button is clicked.
@@ -111,12 +113,16 @@ export abstract class IgxButtonBaseDirective implements AfterViewInit{
111113 if ( this . _platformUtil . isBrowser && ! this . _viewInit ) {
112114 this . _viewInit = true ;
113115
114- animationFrameScheduler . schedule ( ( ) => {
116+ this . _animationScheduler = animationFrameScheduler . schedule ( ( ) => {
115117 this . element . nativeElement . style . removeProperty ( '--_init-transition' ) ;
116118 } ) ;
117119 }
118120 }
119121
122+ public ngOnDestroy ( ) : void {
123+ this . _animationScheduler . unsubscribe ( ) ;
124+ }
125+
120126 /**
121127 * @hidden
122128 * @internal
You can’t perform that action at this time.
0 commit comments