I have the following component in angular
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-status',
templateUrl: './status.component.html',
styleUrls: ['./status.component.css']
})
export class StatusComponent implements OnInit {
constructor() { }
ngOnInit() {
const acc = document.getElementsByClassName('accordion');
let i;
for (i = 0; i < acc.length; i++) {
acc[i].onclick = function() {
this.classList.toggle('active');
this.nextElementSibling.classList.toggle('show');
};
}
}
}
i'm retrieving the following error from the compiler
ERROR in src/app/components/status/status.component.ts(16,16): error TS2339: Property 'onclick' does not exist on type 'Element'.
Altough the compilation is success and all works as expected.
Should i ignore the error?