Angular js reload

0

Person, I noticed that whenever I reload the page, while page is being loaded, it shows all the keys {{}} of the scopes of my project, is it normal? the page containing the scopes coming from a get json is in php ....

    
asked by anonymous 05.01.2017 / 20:45

1 answer

1

It is 'normal' for this to happen because the angular only renders the view after the DOM is fully loaded. While this does not happen, {{}} are just normal characters.

There is an angular directive to prevent this, ngCloak , which simply helps to hide all content until the angle renders the DOM. link

Just put this directive in a parent element of the page (it's important that it be next to or underneath the element that contains the ng-app directive), and after finishing loading, the angle removes references to it alone, everything appears normally.

Finally, to work correctly, in your main CSS, you need to add the following code:

[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
  display: none !important;
}

I hope I have helped! Abs!

    
06.01.2017 / 07:22