causing error when trying to access the child, event though the ngSwitch condition is loading the child.
ERROR TypeError: Cannot read property 'medFileForm' of undefined
html файл, в котором добавляется дочернее приложение-detail.
<div class="tab-slider--container" [ngSwitch]="viewMode">
<div id="detailTab" *ngSwitchCase="'detailTab'">
<app-detail ></app-detail>
</div>
<div id="pomrTab" *ngSwitchCase="'pomrTab'">
<app-pomr-actd></app-pomr-actd>
</div>
</div>
<button type="button" (click)="search()" >Search</button>
компонент, в котором пытается установить дочернее значение, которое возвращает undefined.
viewMode = 'detailTab';
@ViewChild(DetailComponent, { static: true }) childDetail: DetailComponent;
constructor(){}
search(){
//server call & trying to patch that value to child
this.childDetail.medFileForm.patchValue(medFiles); //ERROR TypeError: Cannot read property 'medFileForm' of undefined
}