I have a navigation menu with links to different sections. This navigation bar is a list which is only displayed by clicking on the button 'menu'. I would like that on load of the new section this list is not displayed.
Therefore I thought I could use $location.path() to detect any change on the url and if so remove the class.
The idea is:
if($location.path() CHANGES){
document.querySelector('[data-navigation]').classList.remove('open-status');
}
How do you make a conditional statement using $location to trigger an action when the url changes.
P.D. The url at this moment works with an hashtag. So it would be: www.whatever.com/#about