Chore: Upgrade to Angular v14
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@@ -15,14 +15,14 @@ import { UserService } from '../user.service';
|
||||
})
|
||||
export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: User = new User();
|
||||
hide: boolean;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private dialog: MatDialog,
|
||||
private ser: UserService,
|
||||
@@ -46,9 +46,9 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
showItem(item: User) {
|
||||
this.item = item;
|
||||
(this.form.get('name') as FormControl).setValue(item.name);
|
||||
(this.form.get('password') as FormControl).setValue('');
|
||||
(this.form.get('lockedOut') as FormControl).setValue(item.lockedOut);
|
||||
(this.form.get('name') as UntypedFormControl).setValue(item.name);
|
||||
(this.form.get('password') as UntypedFormControl).setValue('');
|
||||
(this.form.get('lockedOut') as UntypedFormControl).setValue(item.lockedOut);
|
||||
this.form.setControl(
|
||||
'roles',
|
||||
this.fb.array(
|
||||
@@ -123,7 +123,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.name = formModel.name;
|
||||
this.item.password = formModel.password;
|
||||
this.item.lockedOut = formModel.lockedOut;
|
||||
const array = this.form.get('roles') as FormArray;
|
||||
const array = this.form.get('roles') as UntypedFormArray;
|
||||
this.item.roles.forEach((item, index) => {
|
||||
item.enabled = array.controls[index].value.role;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user