ViewChildren not finding Dynamic Components

后端 未结 1 472
一个人的身影
一个人的身影 2021-01-02 00:14

A parent component that contains a @ViewChildren is not returning results for components that are created dynamically.

The container component contains a highl

相关标签:
1条回答
  • 2021-01-02 00:55

    That doesn't work because @ViewChildren only queries its own view, not the view contained within child components. Your dynamic component is a child component that has its own view.

    To get around this you could add a @ViewChildren query in the dynamic component that has an output event to let anyone who cares (your parent component) know that a new instance exists.

    0 讨论(0)
提交回复
热议问题