sensei
sensei

Reputation: 7542

Load different component dynamically based on condition

I have two components. Component A and Component B.

If I choose A from drop down I would like to route to /shop component and load component A into it, if I selected B from drop down I would like to route to /shop route and load component B into it. This is for example useful if you have different payment providers and you have different component structure and you don’t want to route with IFs to /componentA and /componentB.

Now I found that using ComponentFactoryResolver might be the way to go? Am I looking into right direction?

I would also like to avoid if else at any cost based on drop down selection so I will probably use some kind of strategy pattern here.

What would be most elegant way doing this?

Upvotes: 0

Views: 499

Answers (1)

Shubham Sali
Shubham Sali

Reputation: 482

Used & follow the same:

Upvotes: 1

Related Questions