The ng-cloak directive in Angularjs is used to hide the raw AngularJS code on the browser during the loading or compile process.
The ng-cloak directive is used to avoid the unwanted flicker effect during the loading process.
We can use the ng-cloak directive for the entire application by applied on <body> tag either we can use multiple ng-cloak directive for the smaller parts individually.
The CSS style for hide ng-cloak Directive content.
When the compile process complete the AngularJS Application element make the ng-cloak Directive content visible automatically.
Syntax for ng-cloak directive in AngularJS:
Sample coding for ng-cloak directive in AngularJS:
Code Explanation for ng-cloak directive in AngularJS:
The set of CSS style to hide the content in the ng-cloak directive.
The <h2> tag content is use ng-cloak directive.
Sample Output for ng-cloak directive in AngularJS:
The output displays the content after the page load finishes.
Using the ng-cloak directive that will be hide the content during the page load, when the compile process complete then only the content will be displayed.
Without the CSS style or ng-cloak directive that will be show the raw code of AngularJS during the page load, when the compile process complete then only the content will be displayed.
Tips and Notes
The above CSS rule will be embedded within angular.js and angular.min.js for learners understanding that will be hard coded here.
Related Searches to angularjs ngclassodd directive
ng-class-odd not workingng-class-odd exampleng-class-even styleng class expressionng-class not workingng-class ifcss even oddngclassoddng-repeat $evenangularjs table row colorng-style-oddng-repeat alternativeng-class-odd directiveangularjs tutorials