I am working on a project where I need to display a different template/component based on what my endpoint response is.
For example
{data: {type: 1, textToDisplay: 'I want beans'} }
Should inject Component 1 into the main app template.
If the data is
{data: {type: 2, textToDisplay: 'I want cheese', numberToDisplay: '101' } }
Should inject Component 2 into the main app template and of course Component 2 would be different to Component 1 because there's extra properties.
I really don't want to use bad practice by appending elements into the main app template nor do I want to write a massive template with [if]
directives as we could have many, 5-8, different components to render and it would bloat the template.
What's a suitable way?