How to implement conditional logic in AngularJS views

I have a controller with items. Let's say I want to display items in a table if there are any items. How can such logic be implemented in a "view"?

ng-repeat already takes care of it for you. ng-repeat only puts in html there if there are items.

Alternately, if you dont even want the table element to be there ( not even mess with calculations! ) you could do something like :

<table class="table" ng-show="items.length">
<tr ng-repeat="item in items">
<td>{{item}}</td>
</tr>
</table>

Hope this helps.

Check http://www.codinginsight.com/angularjs-if-else-statement/

The infamous angularjs if else statement!!! When I started using Angularjs, I was a bit surprised that I couldn’t find an if/else statement.

So I was working on a project and I noticed that when using the if/else statement, the condition shows while loading. You can use ng-cloak to fix this.

<div class="ng-cloak">
 <p ng-show="statement">Show this line</span>
 <p ng-hide="statement">Show this line instead</span>
</div>

.ng-cloak { display: none }

Thanks amadou