I am facing an issue with accessing a DOM element and manipulating it in another 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:unable to read addClass of undefined
When I try to access Renderer2 within the home component, it works fine. Can someone explain this behavior and offer a solution?