export class AppComponent {
title = 'Dashboard';
navbarmenu = NAVBAR;
constructor(router:Router){
router.events.subscribe((event: NavigationEvent) => {
if(document.querySelector('.a-active')) document.querySelector('.a-active').classList.remove('a-active');
});
setTimeout(() => {
let testTry = document.querySelector('.submenu li a.is-active');
if(testTry){
let anchor = testTry.parentNode.parentNode.parentNode.children[0];
// anchor is a node and throwing an error.
anchor.classList.add('a-active');
}
}
}
}
Error: Property 'classList' does not exist on type 'Node'
I can't start my server if this setTimeout function is not commented. But when the server is running and uncomment. It runs properly but still get an error.
Thanks. Any help would be appreciated.