错误TypeError:无法读取angular5中未定义的ContaComponent.loadComponent的属性'style'

时间:2018-09-23 20:44:32

标签: angular5

我正在尝试删除jQuery代码并实现以下代码,如下所示:-

 $('.abc').hide();
 $('.abc').show();

在angular5中为:-

(<any>document.getElementsByClassName('abc'))[0]['style'].display = 'none';
(<any>document.getElementsByClassName('abc'))[0]['style'].display = 'block';

获取错误:-

ERROR TypeError: Cannot read property 'style' of undefined     at ContaComponent.loadComponent 

However, jQuery code is working fine but I want to remove jQuery dependency as above but getting error.

0 个答案:

没有答案