AngularJS ng-cloak directive
AngularJS instance
Prevent the application from flashing when the page is loading:
<!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 the directive. </p></div></body></html>Running results:
10
Note: This example only demonstrates the application of the directive.
Definition and usage
The ng-cloak directive is used to prevent problems caused by AngularJS code not loading when AngularJS applications are loading.
When AngularJS application is loading, the document may display AngularJS code because the AngularJS code is not loaded, and then there will be a flashing effect. ng-
The cloak directive is to prevent this problem from happening.
grammar
<element ng-cloak></element>
All HTML elements are supported.
Parameter value
The ng-cloak directive has no parameters.
The above is the compilation of the ng-cloak instruction information, and will be supplemented in the future. For reference, if you need it, please refer to it.