Skip to content

Commit c0d8d31

Browse files
authored
[Angular] Migrate to signals (filter.component.ts) (#28210)
1 parent 5e15bfa commit c0d8d31

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

generators/angular/templates/src/main/webapp/app/shared/filter/filter.component.html.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@if (filters.hasAnyFilterSet()) {
1+
@if (filters().hasAnyFilterSet()) {
22
<div class="filter-display">
33
<span>__jhiTranslateTag__('entity.filters.set')</span>
44
<button class="btn" (click)="clearAllFilters()" (keydown.enter)="clearAllFilters()">
55
<fa-icon icon="times" title="__jhiTranslatePipe__('entity.filters.clearAll')"></fa-icon>
66
</button>
77
<ul>
8-
@for (filterOption of filters.filterOptions; track filterOption.name) {
8+
@for (filterOption of filters().filterOptions; track filterOption.name) {
99
@for (value of filterOption.values; track value) {
1010
<li>
1111
<span>{{ filterOption.name }}:</span> {{ value }}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input } from '@angular/core';
1+
import { Component, input } from '@angular/core';
22
import { IFilterOptions } from './filter.model';
33
import SharedModule from '../shared.module';
44

@@ -8,13 +8,13 @@ import SharedModule from '../shared.module';
88
templateUrl: './filter.component.html',
99
})
1010
export default class FilterComponent {
11-
@Input() filters!: IFilterOptions;
11+
readonly filters = input.required<IFilterOptions>();
1212

1313
clearAllFilters(): void {
14-
this.filters.clear();
14+
this.filters().clear();
1515
}
1616

1717
clearFilter(filterName: string, value: string): void {
18-
this.filters.removeFilter(filterName, value);
18+
this.filters().removeFilter(filterName, value);
1919
}
2020
}

0 commit comments

Comments
 (0)