by myhf · 13y ago · 0 comments
<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 ?