Strict done!!

This commit is contained in:
2020-11-23 16:42:54 +05:30
parent af343cb7f9
commit afe746ecdc
142 changed files with 1258 additions and 907 deletions

View File

@ -1,5 +1,5 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
@ -16,7 +16,7 @@ import { RoleService } from '../role.service';
export class RoleDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
form: FormGroup;
item: Role;
item: Role = new Role();
constructor(
private route: ActivatedRoute,
@ -37,7 +37,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
const data = value as { item: Role };
this.item = data.item;
this.form.get('name').setValue(this.item.name);
(this.form.get('name') as FormControl).setValue(this.item.name);
this.form.setControl(
'permissions',
this.fb.array(
@ -53,7 +53,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
setTimeout(() => {
this.nameElement.nativeElement.focus();
if (this.nameElement) this.nameElement.nativeElement.focus();
}, 0);
}
@ -70,7 +70,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
}
delete() {
this.ser.delete(this.item.id).subscribe(
this.ser.delete(this.item.id as string).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/roles');