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> 

demo


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -