I am trying to show child component after receiving data from parent component. I have make this steps to do it :
- I've declare the component selector in parent html page.
Send the data from parent to the child component
Show(text: string)method:private text: string; Show (text: string){ this.text = text; }So after that i insert
*ngIf="text"for div in my child component to show data only when my component received it.
But when I call show method of my child component the text variable is empty and my child component doesn't shows. I think it is because child component selector in my parent html page create a new instance of object, that has an empty text value. How i can solve this ?
UPDATED
I am trying to use @Input. It's working. But working for string. How i can send to the input some class instance ?
[text]="textin child:@Input text: string;- SwooxisLoadedto your component, initialyfalse, use *ngIf with this boolean, and set it to true just after you dothis.text = text- Pac0