The ng-switch
works as ...well... a javascript switch
, you need to use ng-switch on
along with ng-switch-when
for it to work (check the example here). However, in this case, ng-switch
doesn't seem to be a good solution, what you need is something like AngularUI ui-if
directive (src code here):
What? Remove elements from the DOM completely instead of just hiding it.
Why? In situations where DOM traversal matters (such as the CSS selectors :first-child, :last-child and :nth()-child), simply hiding elements is not enough.
Example:
<div ui-if="link.submenu">
jsfiddle: http://jsfiddle.net/bmleite/fBLTd/