I load a component with method viewContainerRef.createComponent() and store it in a variable.
That component has child components and I need to obtain the variable from one kind of childs.
The code will be something like that:
Parent:
<div #childLoader></div>
this.loadedChild1 = this.childLoader.createComponent(child1);
Child1:
<child2></child2>
<another></another>
<child2></child2>
Child2:
@Component({
selector: 'child2',
templateUrl: 'child2.html'
})
export class Child2Component {
@Input() title: string;
public getTitle(){
return this.title;
}
}
What I'm trying after loading parent component is to acces title, other public var or in fact getTitle() method ignoring the other childs of Child1.
I'm trying to get child2 method/var from this.loadedChild1.
Is that possible?
Thank you.