tarangkhandelwal / components-by-selector

Created with StackBlitz ⚡️
https://stackblitz.com/edit/components-by-selector
10 stars 6 forks source link

Add example of component with inputs #2

Closed gbrunow closed 3 years ago

gbrunow commented 3 years ago

The article Rendering dynamic components by selector name in Ivy talks about some custom binding functionality provided by the DynamicSelectorComponent but the sample component doesn't have any inputs.

I've been playing around with the stackblitz and still haven't been able to figure out how to work with inputs.

tarangkhandelwal commented 3 years ago

Thanks for opening the issue.

I have updated the example to include the inputs passed to a component rendered via a selector.

<app-dynamic-selector *ngIf="showComponent"
[inputs]="{inputValue: 'My Input Value'}"
[componentSelector]="'app-dynamic1'"
[moduleLoaderFunction]="getModuleLoader()"
></app-dynamic-selector>

Commit:

https://github.com/tarangkhandelwal/components-by-selector/commit/7791db29ef0f1f15200a0d4fd65d4a4a2cd95e34

gbrunow commented 3 years ago

Thanks @tarangkhandelwal! Great job, by the way.

gbrunow commented 3 years ago

FYI, the stackblitz seems to be broken now.

tarangkhandelwal commented 3 years ago

FYI, the stackblitz seems to be broken now.

I will try to check & fix why this isn't working in stackblitz. But it should work locally.