我在组件中有一个QueryList。我动态地添加其他组件,这些组件将出现在QueryList中,但是如果我订阅了changes of QueryList,什么都不会发生。我认为这是因为我订阅了ngAfterViewInit,但QueryList在ngOnInit中是undefined。}) QueryList
然后,在QueryList属性的setter上设置一个断点。这表明列表计数为0。似乎对init的调用是在属性上调用setter之后执行的。
如何在调用QueryList设置程序之前为列表调用Init方法?代码片段: //The binding property for the combo box publicList<string>
我有一个对象的QueryList。我需要根据用户交互对DOM元素进行重新排序: @ViewChildren('mytemplate') temp: QueryList<MyObjects>;
this.temp.reset(arr) // sorts the temp but DOM elements stays in the same order QueryList你知道如何根据Query