javascript - Combining ngClick with ngSwitch -
i know scoping issue, can't seem figure out. want change 1 div 1 pressing button. in other words, ng-click
perform necessary changes ng-switch
activate.
however, buttons both nested within respective ng-switch-when
div
i'm assuming problem.
here fiddle of i'm talking about: http://jsfiddle.net/ggkgx/8/
thank in advance!
in angular, ng-switch creates new scope, means variables set in ng-switch
constructs aren't accessible outside of it.
in current scenario have defined thingtoshow
in controller use $parent.thingtoshow
<button ng-click="$parent.thingtoshow='two'">switch!</button>
Comments
Post a Comment