I have this simple dom that I would like to achieve:
<header>
<button class="open-btn></button>
</header>
<nav class="active">
<button class="close-btn"></button>
</nav>
How do I achieve the simple addClass and removeClass function on Angular with separate element?
I've read up on Service, Factory, and Controller, it sounds quite confusing to me.
I've able to successfully used Controller to do add and remove class on the same controller, let's say open-btn and close-btn both under nav, but how about if I am using different element? What I've done seems quite wrong to me, is it the right way? Do I have to register it to Service/Factory instead?
Scenario:
When the user click on open-btn, the element nav will have a class of active, if the user click on close-btn, then nav will remove it's active button.
This seems so easy with jQuery, but how would I do it with Angular way?