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" />
<input matInput [formField]="form.name" />
</mat-form-field>
</div>
@@ -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 { MatCheckboxModule } from '@angular/material/checkbox';
@@ -24,8 +24,7 @@ export interface RoleDetailFormData {
styleUrls: ['./role-detail.component.css'],
imports: [MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, FormField],
})
export class RoleDetailComponent implements AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
export class RoleDetailComponent {
private route = inject(ActivatedRoute);
private router = inject(Router);
private snackBar = inject(MatSnackBar);
@@ -60,12 +59,10 @@ export class RoleDetailComponent implements AfterViewInit {
return implied;
});
ngAfterViewInit() {
setTimeout(() => {
if (this.nameElement !== undefined) {
this.nameElement.nativeElement.focus();
}
}, 0);
constructor() {
afterNextRender(() => {
this.form().focusBoundControl();
});
}
save() {