Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Angular brackets until javascript loaded

I have a few bits of HTML like

<p class="noresults">{{numberOfContacts}} Results Are Available</p>

Is it possible for me to hide {{numberOfContacts}} until Angular has loaded? So it would just say Results Are Available

I've seem some solutions such as hiding the entire body until Angular has loaded, but I'd rather not do that if possible.

like image 649
TMH Avatar asked Feb 25 '14 09:02

TMH


2 Answers

Yes, use ng-cloak. Simply add class="ng-cloak" or ng-cloak to an element like this

Using directive <div ng-cloak></div>

Using class <div class="ng-cloak"></div>

It's simply a set of CSS rules with display: none !important and as Angular has rendered your DOM it removes the ng-cloak so an element is visible.

like image 64
lukas.pukenis Avatar answered Oct 03 '22 13:10

lukas.pukenis


use <span ng-bind="numberOfContacts" /> instead of {{numberOfContacts}}

like image 45
Rama Krshna Ila Avatar answered Oct 03 '22 14:10

Rama Krshna Ila