I want to create an attribute that calls (click) from setAtributte (), but it tells me this error:
ERROR DOMException: Failed to execute 'setAttribute' on 'Element':
'(click)' is not a valid attribute name.
Search all over Google and I'm not finding the solution, I know it's the parentheses but I need to make the angular execute a function. I do not want to have to create an onClick attribute to then have to create a Jquery file and from there execute the method.
Part of the code and where the error is applied:
this.renderer.appendChild(this.el.nativeElement, div);
this.renderer.setAttribute(button, 'type', 'button');
this.renderer.setAttribute(button, 'data-toggle', 'modal');
this.renderer.setAttribute(button, 'data-target', '#modalArbol');
this.renderer.setAttribute(button, '(click)', 'mostrarId()');
this.renderer.addClass(button, 'wild');
this.renderer.addClass(button, 'btn-primary');