I have a list that when I click on it, I need the display: listview
to be changed to display: none
.
My list is composed like this:
<li class="sub">
<a class="dropdown-item waves-effect" (click)="verificaPermissao(9, 'confestoque')">
<i class="mr-3 fa fa-archive"></i>Estoque</a>
</li>
In my function verificaPermissão
, I need to set the display
to none
when the click occurs. I tried with nativeElement
:
Builder:
private el: ElementRef
Typescript:
verificaPermissao(idTela?: number, nomeRota?: string){
let lista = this.el.nativeElement.querySelector(".sub");
lista.classList.remove('display')
}
I've also tried:
const element = document.getElementsByClassName('sub');
this.renderer.setElementAttribute(element, "display", "none");
But I get:
ERROR TypeError: el.setAttribute is not a function at
How can I access the display
property of my sub class?