Updated to angular 11

Now compiling with strict mode in typescript
Need to error checking now
This commit is contained in:
tanshu committed 2020-11-22 10:13:37 +05:30
1 parent cabd6f2ea1
commit 6567f560ab
187 files changed
+1709 -1184

No files matched your search

@@ -14,9 +14,9 @@ import { PrinterService } from '../printer.service';
styleUrls: ['./printer-detail.component.css'],
})
export class PrinterDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
form: FormGroup;
item: Printer;
item: Printer = new Printer();
constructor(
private route: ActivatedRoute,
@@ -26,10 +26,7 @@ export class PrinterDetailComponent implements OnInit, AfterViewInit {
private toaster: ToasterService,
private ser: PrinterService,
) {
this.createForm();
}
createForm() {
// Create form
this.form = this.fb.group({
name: '',
address: '',
@@ -38,7 +35,8 @@ export class PrinterDetailComponent implements OnInit, AfterViewInit {
}
ngOnInit() {
this.route.data.subscribe((data: { item: Printer }) => {
this.route.data.subscribe((value) => {
const data = value as { item: Printer };
this.showItem(data.item);
});
}
@@ -54,7 +52,9 @@ export class PrinterDetailComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
setTimeout(() => {
this.nameElement.nativeElement.focus();
if (this.nameElement !== undefined) {
this.nameElement.nativeElement.focus();
}
}, 0);
}
@@ -71,7 +71,7 @@ export class PrinterDetailComponent 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('/printers');