html - Using ng-switch with buttons -


i'm trying use ng-switch 2 buttons in order show html elements depending on button clicked. have not seen example that

here's code far:

<button name="withdraw" ng-click="type(name)">withdraw</button> <button name="enter" ng-click="type(name)">enter amount 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 one:

<button name="withdraw" ng-click="name = 'withdraw'">withdraw</button> <button name="enter" ng-click="name = 'enter'">enter amount withdraw</button> <hr>  <div ng-switch="name">         <div ng-switch-when="withdraw">             code 1         </div>         <div ng-switch-when="enter">             code 2         </div> </div> 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -