CSS After HTML Loads

I have been trying to apply CSS on element (A)'s child element(B). 

But the problem is making your custom A.css with the target of B.html, your changes are overwritten by B.css that are not in your control.

No problem!

Use your Dev skills to identify the elements target location that we need in the next stage like this:

Target HTML page:


Console:


You can see in the last step we are able to achieve it on first tag <div> of first <th> tag. And it looks something like this

document.getElementsByTagName('th')[0].getElementsByTagName('div')[0].setAttribute('style','color:red;');


Now let us look at the steps needed in A.component.ts file:

We will use ViewChild Decorator - https://blog.angular-university.io/angular-viewchild/

Renderer -


Comments

Popular posts from this blog

Angular Pie Chart

Spring Boot Export Data to Excel Example