Skip to content

Commit ffb543f

Browse files
committed
Get rid of onDestroy from directives
1 parent b71d05d commit ffb543f

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

projects/imagekit-angular/src/lib/directives/ik-image.directive.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Inject,
77
Optional,
88
Renderer2,
9-
OnDestroy
109
} from '@angular/core';
1110
import { ImageKitService } from '../services/imagekit.service';
1211
import { IMAGEKIT_CONFIG } from '../config/imagekit.config';
@@ -57,7 +56,7 @@ import { getInt, validateUrlEndpoint, getTransformationConfig } from '../utils/c
5756
exportAs: 'ikImageDirective',
5857
standalone: true
5958
})
60-
export class IKImageDirective implements OnChanges, OnDestroy {
59+
export class IKImageDirective implements OnChanges {
6160
/**
6261
* Image source path - can be relative (requires imagekit urlEndpoint to be configured or passed) or absolute URL
6362
*/
@@ -155,11 +154,7 @@ export class IKImageDirective implements OnChanges, OnDestroy {
155154
ngOnChanges(): void {
156155
this.updateImageAttributes();
157156
}
158-
159-
ngOnDestroy(): void {
160-
// Cleanup if needed
161-
}
162-
157+
163158
private updateImageAttributes(): void {
164159
const urlEndpoint = validateUrlEndpoint(this.urlEndpoint, this.config);
165160

projects/imagekit-angular/src/lib/directives/ik-video.directive.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Inject,
77
Optional,
88
Renderer2,
9-
OnDestroy
109
} from '@angular/core';
1110
import { ImageKitService } from '../services/imagekit.service';
1211
import { IMAGEKIT_CONFIG } from '../config/imagekit.config';
@@ -66,7 +65,7 @@ import { validateUrlEndpoint, getTransformationConfig } from '../utils/common.ut
6665
exportAs: 'ikVideoDirective',
6766
standalone: true
6867
})
69-
export class IKVideoDirective implements OnChanges, OnDestroy {
68+
export class IKVideoDirective implements OnChanges {
7069
/**
7170
* Video source path - can be relative (requires imagekit urlEndpoint to be configured or passed) or absolute URL
7271
*/
@@ -103,10 +102,6 @@ export class IKVideoDirective implements OnChanges, OnDestroy {
103102
this.updateVideoSrc();
104103
}
105104

106-
ngOnDestroy(): void {
107-
// Cleanup if needed
108-
}
109-
110105
private updateVideoSrc(): void {
111106
const urlEndpoint = validateUrlEndpoint(this.urlEndpoint, this.config);
112107

0 commit comments

Comments
 (0)