Replace ng-if with ng-switch in template

This reduces the number of watches that will be added to
the corresponding scopes. (each node/leaf will have one
watcher less)