[英]Append element to QueryList Angular
Is there a way to append a new element to a QueryList? 有没有办法将新元素追加到QueryList?
For example, i have a QueryList like this: 例如,我有一个像这样的QueryList:
@ContentChildren(SysColumn) syscolumns: QueryList<SysColumn>;
And i need to append another SysColumn after the view init. 我需要在视图init之后附加另一个SysColumn。 Is it poossible on Angular?
Angular上有可能吗? I try to append but it says that is not a function of a QueryList.
我尝试追加,但它说这不是QueryList的功能。
You can use reset
method 您可以使用
reset
方法
this.syscolumns.reset([...this.syscolumns.toArray(), this.additionalColumn])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.