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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -