Description
I'm submitting a
[X] feature request
I have a component which provides some generic business logic. Let's say:
- CRUD functionality
- Productmanagement (product catalogue)
- Cross department business management (separate layout for each department)
- ...
Depending on a condition I want to show a layout (template) which is specific for a type of product, related to the user department, etc.
Right now I can't load a template on the fly for doing this.
I have read through all the issues here and on stackoverflow for possible ways on doing this.
The most practicabel way is the ngTemplateLayout. But in real life if you have dozens of different layout types, it blows up your template file and make unmaintenable.
If you use the dynamiccomponentloader which is the most recommend way by the angular team, it adds an huge overhead of code for generating the component dynamically, even if the functionality for component and module creation is encapsulated. In addition it doesn't allow a real generic solution, because in the ngModule which has also be created dynamically you have to provide all imports, exports, providers, ... to make the component work. So if you don't want to have a huge overhead in your generic component builder, you have to implement a generic componentbuilder for each "type" of your form types. Which is not practicable and increases the danger of recoding all after the next angular release
Expected behavior
Provide a way of loading a template dynamically for a component. As it is available in Angular 1
Please don't be dogmatic on this issue and consider supporting real world requirements in Angular 2
Thanks