Quantcast
Viewing latest article 22
Browse Latest Browse All 4826

How to supply component and its parameters dynamically in a template

I have a parent component and a child component which extends the parent. I would like to add kind of polymorphic behaviour to the parent template. Basically I would like to instantiate a component inside the parent template which gets provided by the child along with its parameters. Somewhere in the parent template I have a construct like this (doesn’t work exactly as I want it though):

{{component this.formComponent …this.formArgs}}

The desired component gets properly created but it is not fed with the supplied arguments.

How can I supply parameters (the child supplies both - what to create and what args to pass) to the dynamically created component?

In general, I agree it is better to rely on composition vs inheritance but I would like to achieve this behaviour by inheritance.

Thanks!

3 posts - 2 participants

Read full topic


Viewing latest article 22
Browse Latest Browse All 4826

Trending Articles