Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append element to QueryList Angular

Is there a way to append a new element to a QueryList?

For example, i have a QueryList like this:

@ContentChildren(SysColumn) syscolumns: QueryList<SysColumn>;

And i need to append another SysColumn after the view init. Is it poossible on Angular? I try to append but it says that is not a function of a QueryList.

like image 991
Hely Saul Oberto Avatar asked Nov 13 '17 16:11

Hely Saul Oberto


1 Answers

You can use reset method

this.syscolumns.reset([...this.syscolumns.toArray(), this.additionalColumn])

Stackblitz Example

like image 112
yurzui Avatar answered Nov 12 '22 04:11

yurzui