I need to access dom element and manipulate in other class
homeComponent.ts
import{TableUtility} from "src/shared/table-utility";
export class HomeComponent extends TableUtility{
constructor(){super()}
homeComponent.html
<button (click)="toggleClass($event)"><img src="img.png"></button>
tableUtility.ts
import{Table} from "primeng/table";
import{Renderer2} from "@angular/core";
export class TableUtility{
constructor(public render:Renderer2)
togglClass(ev){
console.log(this.render.addClass(ev.target,"active");
}
Err:cannot read addClass of undefined
If I use it within home component I can read Renderer2. Can someone tell this with proper reason and how to solve this.