diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts index 1fe046dda49c44067c5883653dd8d3b749e0a493..3e65ca6c9270ffa984cba6475b200f310d8ebac1 100644 --- a/src/app/form/form.component.ts +++ b/src/app/form/form.component.ts @@ -126,6 +126,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro nitem.imgCss = {}; return nitem; }); + this.initWithDataAfterData(); }); } @@ -292,7 +293,10 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro } focusUserInput() { setTimeout(() => { - this.partConfigBoxes.toArray()[this.currentEditPartIndex].nativeElement.querySelector('input').focus(); + const ipt = this.partConfigBoxes.toArray()[this.currentEditPartIndex].nativeElement.querySelector('input') + if (ipt) { + ipt.focus(); + } }, 10); } editPart(idx) { @@ -403,8 +407,10 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro } + ngAfterViewInit(){ - ngAfterViewInit() { + } + initWithDataAfterData() { // console.log('ngAfterViewInit'); this.partConfigBoxes.changes.subscribe(t => {