zl程序教程

您现在的位置是:首页 >  其它

当前栏目

[AngularJS] ngCloak

angularjs
2023-09-14 09:00:55 时间

The ngCloak directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Use this directive to avoid the undesirable flicker effect caused by the html template display.

Add those code to css:

[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
  display: none !important;
}

 

Usage:

<div id="template1" ng-cloak>{{ 'hello' }}</div>
<div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>

 

See: https://docs.angularjs.org/api/ng/directive/ngCloak