Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJs: why doesn't ng-switch update when I use ng-click?

Tags:

angularjs

I tried using ng-click to update the variable used in ng-switch, but ng-switch doesn't seem to have picked up the change. See the example here: http://plnkr.co/edit/jx8DNlrJDuaUBKVwZQtQ

What am I doing wrong?

like image 380
extraeee Avatar asked Feb 14 '23 09:02

extraeee


1 Answers

You're running into scope inheritance issues. See: http://docs.angularjs.org/guide/scope

Fixed version: http://plnkr.co/edit/ENm5HBYno8yHblLlE8CA?p=preview

like image 137
Jeff Hubbard Avatar answered Feb 16 '23 21:02

Jeff Hubbard