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

angular - DownloadURL return null in below code -

meteor - inserting data to database gives error "insert failed: Method '/texts/insert' not found" -