You can control any DOM element via ElementRef by injecting it into your component’s constructor. i.e, The component should have constructor with ElementRef parameter,
1 2 3 | constructor(myElement: ElementRef) { el.nativeElement.style.backgroundColor = 'yellow'; } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.