Removed Recipe Template as it was not needed.
Moved host listeners to the component declaration. Form submit on Return fixed.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<h2>Net Transactions</h2>
|
||||
|
||||
<form class="flex-col" [formRoot]="form">
|
||||
<form class="flex-col" [formRoot]="form" (submit)="$event.preventDefault(); show()">
|
||||
<div class="row-container">
|
||||
<mat-form-field class="flex-auto basis-2-5">
|
||||
<mat-label>Start Date</mat-label>
|
||||
@@ -14,7 +14,7 @@
|
||||
<mat-datepicker-toggle matSuffix [for]="finishDate"></mat-datepicker-toggle>
|
||||
<mat-datepicker #finishDate></mat-datepicker>
|
||||
</mat-form-field>
|
||||
<button mat-raised-button class="flex-auto basis-1-5" color="primary" (click)="show()">Show</button>
|
||||
<button mat-raised-button type="submit" class="flex-auto basis-1-5" color="primary">Show</button>
|
||||
</div>
|
||||
</form>
|
||||
@if (infoResource.isLoading()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CurrencyPipe } from '@angular/common';
|
||||
import { Component, HostListener, inject, input, linkedSignal, computed, afterNextRender, signal } from '@angular/core';
|
||||
import { Component, inject, input, linkedSignal, computed, afterNextRender, signal } from '@angular/core';
|
||||
export interface NetTransactionsFormData {
|
||||
startDate: Date;
|
||||
finishDate: Date;
|
||||
@@ -25,6 +25,9 @@ import { NetTransactionsService } from './net-transactions.service';
|
||||
selector: 'app-net-transactions',
|
||||
templateUrl: './net-transactions.component.html',
|
||||
styleUrls: ['./net-transactions.component.css'],
|
||||
host: {
|
||||
'(window:keydown.f2)': 'focusDate($event)',
|
||||
},
|
||||
imports: [
|
||||
FormField,
|
||||
FormRoot,
|
||||
@@ -103,7 +106,6 @@ export class NetTransactionsComponent {
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['type', 'name', 'debit', 'credit'];
|
||||
|
||||
@HostListener('window:keydown.f2', ['$event'])
|
||||
focusDate(event: Event) {
|
||||
event.preventDefault();
|
||||
// TODO: Also select the text
|
||||
|
||||
Reference in New Issue
Block a user