1616 See the License for the specific language governing permissions and
1717 limitations under the License.
1818- %>
19- import { Directive, EventEmitter, Input, Output } from '@angular/core';
19+ import { Directive, input, output, OutputEmitterRef } from '@angular/core';
2020import { SortOrder, SortState, SortStateSignal } from './sort-state';
2121
2222export interface SortChangeDirective<T > {
23- sortChange: EventEmitter <SortState >;
23+ sortChange: OutputEmitterRef <SortState >;
2424
2525 sort(field: T): void;
2626}
@@ -29,12 +29,12 @@ export interface SortChangeDirective<T> {
2929 selector: '[<%= jhiPrefix %> Sort]',
3030})
3131export class SortDirective implements SortChangeDirective<string > {
32- @Input() sortState!: SortStateSignal;
32+ readonly sortState = input.required< SortStateSignal >() ;
3333
34- @Output() sortChange = new EventEmitter <SortState >();
34+ readonly sortChange = output <SortState >();
3535
3636 sort(field: string): void {
37- const { predicate, order } = this.sortState();
37+ const { predicate, order } = this.sortState()() ;
3838 const toggle = (): SortOrder => (order === 'asc' ? 'desc' : 'asc');
3939 this.sortChange.emit({ predicate: field, order: field !== predicate ? 'asc' : toggle() });
4040 }
0 commit comments