Angular js Reload

Asked

Viewed 189 times

0

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

  • Put the code in your question!

1 answer

1

It is 'normal' to do this, as the angular process the view only after the DOM is fully charged. While this does not happen, {{ }} are only normal characters.

There is an angular directive to prevent this, the ngCloak, that simply helps to hide all content until the angular processes the DOM. https://docs.angularjs.org/api/ng/directive/ngCloak

Simply place this directive on a parent element of the page (it is important that it be next to or below the element that contains the ng-app directive), and after finishing the load, the angler removes the references to it by itself, making everything appear normally.

Finally, to work properly, 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 helped! Abs!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.