TemplateRef需要类型参数
问题描述:
组件的HTML:TemplateRef需要类型参数
<ng-template #content/> </ng-template>
组件TS:
@ViewChild('content')
public content: TemplateRef;
的Visual Studio消息:
[ts] Generic type 'TemplateRef<C>' requires 1 type argument(s)
我应该只让TemplateRef<any>
? 虽然代码示例似乎从未指定泛型。 这是新的吗?
答
在角材料2他们用
TemplateRef<any>
到处 https://github.com/angular/material2/search?utf8=%E2%9C%93&q=templateref&type=
我还没有看到任何地方这种类型的参数是相关的。