Search code examples
angularjstemplatesrenderinginterpolationloading

AngularJS rendering interpolation as template syntax during load


A client of mine has an issue with his AngularJS Project that during the loading, some interpolations are rendered as text before they are replaced with the proper content. I haven't encountered this behavior before. Does anyone know what they might be doing wrong?

enter image description here


Solution

  • Use the ng-cloak directive to avoid the undesirable flicker effect caused by the html template display.

    From the Docs:

    The ngCloak directive is used to prevent the AngularJS html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading.

    The directive can be applied to the <body> element, but the preferred usage is to apply multiple ngCloak directives to small portions of the page to permit progressive rendering of the browser view.

    For more information, see