Michele Tilley's got it exactly right, I believe, particularly in pointing out the contrast with ngShow
/ngHide
. There's one additional difference to note: ng-If
will detach and re-attach an element in-place. But ng-Switch
has an outer containing element on which you declare the main directive and its condition: ng-switch="expression"
. The conditional content within that outer element will be append()
-ed as the last child of the outer element, thus changing its position relative to any non-conditional content within the outer element.
And, see this CodePen for an interactive demo of all three, showing the differences in execution.
EDIT: This behavior changed in Angular 1.2. Elements are now left in place. The Codepen above mentions and demonstrates this, providing a link to a 1.08 Plunk that has sadly been wiped out...