Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make an element with ng-if start hidden (prevent it from showing during page load)

When i want to make something start as hidden with ng-show you can just add class="ng-hide" so the css will hide the element beforehand. This way an element won't be shown when the page is still loading

I want to do the same thing using ng-if but i don't know how to do it

like image 383
valepu Avatar asked Jan 27 '16 15:01

valepu


1 Answers

As Michiel suggested, using the ngCloak directive is the solution.
Just add ng-cloak to the class attribute of the tag you want to keep hidden while your application is loading.

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

For more details: https://docs.angularjs.org/api/ng/directive/ngCloak

like image 135
smartmouse Avatar answered Dec 05 '22 15:12

smartmouse