AngularJS Basic ng cloak Simple Example

  • 2021-07-06 10:12:58
  • OfStack

AngularJS ng-cloak Directive

AngularJS instance

Prevent application flickering when page loads:


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>

<div ng-app="">

<p ng-cloak>{{ 5 + 5 }}</p>

<p><b> Note: </b>  This example only demonstrates the application of instructions. </p>

</div>

</body>
</html>

Run results:

10

Note: This example only demonstrates the application of instructions.

Definition and usage

The ng-cloak instructions are used to prevent the AngularJS code from being loaded when the AngularJS application is loaded.

When the AngularJS application is loaded, the document may display the AngularJS code because the AngularJS code is not loaded completely, and then there will be a flashing effect, ng-

The cloak directive is intended to prevent this problem.

Grammar

< element ng-cloak > < /element >

All HTML elements are supported.

Parameter value

The ng-cloak instruction has no parameters.

The above is the collation of ng-cloak instruction data, and the follow-up will continue to be supplemented. Friends in need will refer to it.


Related articles: