I'm trying to use ng-switch
with 2 buttons in order to show HTML elements depending on which button is clicked. I have not seen any example like that
here's my code so far:
<button name="withdraw" ng-click="type(name)">Withdraw</button>
<button name="enter" ng-click="type(name)">Enter Amount to Withdraw</button>
<hr>
<div ng-switch="type(name)">
<div ng-switch-when="withdraw">
//code
</div>
<div ng-switch-when="enter">
//code
</div>
</div>
Just try this one:
<button name="withdraw" ng-click="name = 'withdraw'">Withdraw</button>
<button name="enter" ng-click="name = 'enter'">Enter Amount to Withdraw</button>
<hr>
<div ng-switch="name">
<div ng-switch-when="withdraw">
code 1
</div>
<div ng-switch-when="enter">
code 2
</div>
</div>