Tuesday, 22 August 2017

AngularJS ng-cloak Directive

Example

Prevent the application from flicker at page load:
<div ng-app="">

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

</div>
Try it Yourself »

Definition and Usage

Angular.js does not execute till after the html(view) is loaded, so at times for a split second you can see pre-execution syntax. For example - Hello, {{ username }} instead Hello Puroo. Ng-cloak makes it wait for Angular JS execution.


The ng-cloak directive prevents the document from showing unfinished AngularJS code while AngularJS is being loaded.
AngularJS applications can make HTML documents flicker when the application is being loaded, showing the AngularJS code for a second, before all code are executed. Use the ng-cloak directive to prevent this.

Syntax

<element ng-cloak></element>
Supported by all HTML elements.

Parameter Values

The ng-cloak directive has no parameters.

1 comment: