Skip to content

Commit 6bc391c

Browse files
SkyZeroZxAndrewKushnir
authored andcommitted
refactor(docs-infra): replace @input with signal input for ignoredElementsIds in ClickOutside directive (angular#64302)
replace @input with signal input for ignoredElementsIds in ClickOutside directive PR Close angular#64302
1 parent 4bcbac1 commit 6bc391c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

adev/shared-docs/directives/click-outside/click-outside.directive.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {DOCUMENT} from '@angular/common';
10-
import {Directive, ElementRef, Input, inject, output} from '@angular/core';
10+
import {Directive, ElementRef, inject, input, output} from '@angular/core';
1111

1212
@Directive({
1313
selector: '[docsClickOutside]',
@@ -16,8 +16,7 @@ import {Directive, ElementRef, Input, inject, output} from '@angular/core';
1616
},
1717
})
1818
export class ClickOutside {
19-
// TODO: Understand why replacing this @Input with a signal input breaks the tests
20-
@Input('docsClickOutsideIgnore') public ignoredElementsIds: string[] = [];
19+
readonly ignoredElementsIds = input<string[]>([], {alias: 'docsClickOutsideIgnore'});
2120
public readonly clickOutside = output<void>({alias: 'docsClickOutside'});
2221

2322
private readonly document = inject(DOCUMENT);
@@ -33,11 +32,11 @@ export class ClickOutside {
3332
}
3433

3534
private wasClickedOnIgnoredElement(event: MouseEvent): boolean {
36-
if (this.ignoredElementsIds.length === 0) {
35+
if (this.ignoredElementsIds().length === 0) {
3736
return false;
3837
}
3938

40-
return this.ignoredElementsIds.some((elementId) => {
39+
return this.ignoredElementsIds().some((elementId) => {
4140
const element = this.document.getElementById(elementId);
4241
const target = event.target as Node;
4342
const contains = element?.contains(target);

0 commit comments

Comments
 (0)