I have 2 sibling components in Angular2:
<test1 *ngIf="data" [data] = "makes" #test1R></formModel>
<testing *ngIf="data" [test1Ref]="test1R"></testing>
Component "Testing" has a function that call a function of test1 Component:
export class Testing{
@Input() test1Ref: test1Component;
constructor() { }
testFunction($event){
this.test1Ref.hello();
}
My problem is that this.test1Ref is undefined, because test1 component has *ngIf (<test1 *ngIf="data") ,
but without *ngIf I have an error in test1 component for input value ([data] = "makes").
How can I pass component reference with *ngIf