rules
rules copied to clipboard
Render Dynamic Modules
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[ x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
Currently we need to know the type of the component which we use to instantiate and place it to the view, but the problem comes down with more complex component where instantiation would not help and its defined by its module. It imports different services , other modules, etc.
Expected behavior
I expect that for more complex component we need to enable runtime module compilation and take component from there.
e.g.:
const module = await this.compiler.compileModuleAsync(ComboboxModule);
const cmdFactory = module.componentFactories[0];
console.log(module.componentFactories)
const component: ComponentRef<ComboboxComponent> = this.vc.createComponent(cmdFactory);
component.instance.dataSource = this.dataSource;
component.instance.name = 'standard2';
component.instance.placeholder = 'standard2 placeholder';
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Angular version: X.Y.Z
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others: