This commit is contained in:
2026-08-27 05:38:32 +00:00
parent 2a29dc9195
commit 43204e8441
78 changed files with 904 additions and 1235 deletions
@@ -3,7 +3,7 @@
<div class="row-container">
<mat-form-field class="flex-auto">
<mat-label>Name</mat-label>
<input matInput #nameElement [formField]="form.name" (keyup.enter)="save()" />
<input matInput [formField]="form.name" (keyup.enter)="save()" />
</mat-form-field>
</div>
<div class="row-container">
@@ -1,4 +1,4 @@
import { AfterViewInit, Component, ElementRef, ViewChild, computed, inject, linkedSignal, input } from '@angular/core';
import { Component, computed, inject, linkedSignal, input, afterNextRender } from '@angular/core';
import { form, FormField } from '@angular/forms/signals';
import { MatButtonModule } from '@angular/material/button';
import { MatDialog } from '@angular/material/dialog';
@@ -23,8 +23,7 @@ export interface RegimeDetailFormData {
styleUrls: ['./regime-detail.component.css'],
imports: [MatButtonModule, MatFormFieldModule, MatInputModule, FormField],
})
export class RegimeDetailComponent implements AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
export class RegimeDetailComponent {
private route = inject(ActivatedRoute);
private router = inject(Router);
private dialog = inject(MatDialog);
@@ -48,12 +47,10 @@ export class RegimeDetailComponent implements AfterViewInit {
form = form(this.formModel);
ngAfterViewInit() {
setTimeout(() => {
if (this.nameElement !== undefined) {
this.nameElement.nativeElement.focus();
}
}, 0);
constructor() {
afterNextRender(() => {
this.form().focusBoundControl();
});
}
save() {