I have a component like this:
export class ParentComponent implements OnInit, OnDestroy {
@ViewChild(ChildComponent) childComponent: ChildComponent;
}
which is using the childComponent
to make a call, let's say like this:
this.childComponent.method();
within ParentComponent
method.
So, when I am trying to test the ParentComponent
method which is internally using the ChildComponent
, the childComponent is returning as undefined.
How to resolve the issue?