Feb 25, 2017 · 1 min read
How can you pass a parameter to dynamically created component, when you don’t know which component you created dynamically. I mean, let’s say, we have another component to be created dynamically named “AlertComponent2” and it takes another argument called “type2". In your example, you pass the parameter easily
this.componentRef.instance.type = type;
because you knew the component was AlertComponent. Dynamic component creation doesn’t make sense if you know which component you are going to create.