user5950225 user5950225 - 6 months ago 25
AngularJS Question

No data found showing on page loading in AngularJS

I am displaying some data, so while the page is loading, "No data found" control is working, what should I do to prevent this ?
Here is my code

<ul id="owl-example" class="list-unstyled topContributors">
<li ng-show="TopContributors.length==0">
<p><span style="color: red; font-weight: bold;">No Contributors....</span></p>
</li>
<li ng-repeat="contributors in TopContributors">
<img ng-src="{{contributors.AccountName}}" />

<div class="contName">
<p>{{contributors.UserName}}</p>
</div>

</li>
</ul>

Answer

You can add a flag to hide "No Contributors...." until the request is not completed

<li ng-show="TopContributors.length==0 && flag">
  <p><span style="color: red; font-weight: bold;">No Contributors....</span></p>
</li>