<ul>
<li ng-repeat="name in names">{{name}}</li>
<li ng-show="!names.length">There are no names in the list</li>
</ul> <ul>
<li ng-repeat="name in names">{{name}}</li>
<li ng-show="!names.length">There are no names in the list</li>
</ul> <div ng-switch="names.length">
<ul ng-switch-when="0">
<li>There are no names in the list.</li>
</ul>
<ul ng-switch-default>
<li ng-repeat="name in names">{{name}}</li>
</ul>
</div>
Either way you end up with an ugly dom. <ul>
<li ng-repeat="name in names">{{name}}</li>
<li ui-if="!names.length">There are no names in the list</li>
</ul>
: http://angular-ui.github.com/#directives-ifIt isn't "allergic to conditionals". It just drives the logic elsewhere to keep the presentation layer looking as clean as possible to the developer so that you can either focus on the view (template) or the controller or model.
I will. That seems dumb.
Why are conditionals not allowed in presentation layer but repetition is ?
Personally I like the sort of middle-ground approach that Handlebars [1] has, I'm fine with basic 'truthy/existence' type checks, but will avoid templating languages that allow 'any old code'.
I think this sort of discipline (picking a deliberately restrictive library) is probably more useful for teams than individuals (who are capable of limiting their own conditional crazy).