I have two buttons. One is "State1"states for a button, "State1" and another is "State2""State2".
In the beginning, it is in "State2" buttonIt defaults to "State2". ThenWhen I click "State2"the button, it toggletoggles to "State1" button"State1".
When I want to click out of "State1"anywhere outside the button, thenI need it willto change from "State1" button"State1" back to "State2" button"State2". How do I do? This is my code:
<div ng-click="Ctrl.Check = !Ctrl.Check">
<a ng-class="{'btn-danger': !Ctrl.Check, 'btn-default': Ctrl.Check }" >
{{ Ctrl.Check ? 'State1' : 'State2' }}
</a>
</div>