Angular 8.0
`
ERROR DOMException: Failed to execute 'setAttribute' on 'Element': '#imageSlider' is not a valid attribute
`
实现在类中引用模板功能,代码片断如下:
AppComponent.html
`<app-image-slider
[sliders]="imageSliders" #imageSlider>
</app-image-slider>
`
AppComponent.ts
`
export class AppComponent {
@ViewChild('imageSlider', {static: true}) imgSlider: ImageSliderComponent;
`
错误信息如下:(查询很多此类错误一般是拼写错误,但未找到)
应该是个英文半角的
#
,不是全角的#
。