File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
projects/igniteui-angular/directives/src/directives/button Expand file tree Collapse file tree 1 file changed +10
-4
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 'igniteui-angular/core' ;
14- import { animationFrameScheduler } from 'rxjs' ;
15+ import { animationFrameScheduler , Subscription } from 'rxjs' ;
1516
1617export const IgxBaseButtonType = {
1718 Flat : 'flat' ,
@@ -21,10 +22,11 @@ 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 public element = inject ( ElementRef ) ;
27- private _viewInit = false ;
28+ private _viewInit = false ;
29+ private _animationScheduler : Subscription ;
2830
2931 /**
3032 * Emitted when the button is clicked.
@@ -110,12 +112,16 @@ export abstract class IgxButtonBaseDirective implements AfterViewInit{
110112 if ( this . _platformUtil . isBrowser && ! this . _viewInit ) {
111113 this . _viewInit = true ;
112114
113- animationFrameScheduler . schedule ( ( ) => {
115+ this . _animationScheduler = animationFrameScheduler . schedule ( ( ) => {
114116 this . element . nativeElement . style . removeProperty ( '--_init-transition' ) ;
115117 } ) ;
116118 }
117119 }
118120
121+ public ngOnDestroy ( ) : void {
122+ this . _animationScheduler . unsubscribe ( ) ;
123+ }
124+
119125 /**
120126 * @hidden
121127 * @internal
You can’t perform that action at this time.
0 commit comments