Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TemplateRef api change in Angular2 RC0

Tags:

angular

In beta release, I was accessing the template to repeat for a data component via;

    @ContentChild(TemplateRef) itemTemplate: TemplateRef;

With RC0, the error happens is "Generic type 'TemplateRef require 1 type argument(s)"

What kind of type I should define as the generic type? It could be any html content as in;

http://www.primefaces.org/primeng/#/datalist

I believe;

    @ContentChild(TemplateRef) itemTemplate: TemplateRef<any>;

should work as I don't necessarily need any specific type except $implicit.

like image 351
Cagatay Civici Avatar asked Jan 18 '26 19:01

Cagatay Civici


1 Answers

It seems to be working in RC4 using

@ContentChild(TemplateRef) itemTemplate: TemplateRef<any>;
like image 110
gwhn Avatar answered Jan 21 '26 08:01

gwhn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!