Ömer Alper Özkan
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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade