Angular: How to pass data in ngComponentOutlet through Injector

前端 未结 3 802
清酒与你
清酒与你 2021-01-20 10:02

I\'m trying to dynamically create and show component and i need to pass some data into it, so that it knows what to show.

Here is my code:

html part:

3条回答
  •  野的像风
    2021-01-20 10:45

    Hey there change widgets to widgets = [], otherwise angular will keep calling the method in the ngFor loop. If you console log in the constructor for the component you find this is happening.

提交回复
热议问题