Execute a script to find a control and add a class to the control

6 views
Skip to first unread message

Govind Karanam

unread,
May 16, 2019, 6:43:34 AM5/16/19
to Angular and AngularJS discussion

I want to find a div element which is part of a specific route and add a class to the element. I kept the logic in the index.html in document.ready function. But, this happens if the complete page is loaded on the first load (or) page refresh.

I am using Angular 4. So, how do I achieve this?

Thanks in advance.

Sander Elias

unread,
May 17, 2019, 2:30:45 AM5/17/19
to Angular and AngularJS discussion
Hi Govind,

If it's inside a route, it's inside a certain component, right?
Use viewChild in that component, and add the class.

Regards
Sander
Reply all
Reply to author
Forward
0 new messages