0

I'm starting using Angularjs. I have a simple project (HTML + javascript/Angular js). When I visualize the HTML file on my browser I see a second hidden elements. Do you maybe know the reason? How can I solve this?

jrbedard
  • 3,662
  • 5
  • 30
  • 34
  • 2
    Can we see some code? – kzhao14 Nov 18 '16 at 16:45
  • Possible duplicate of [AngularJS strategy to prevent flash-of-unstyled-content for a class](http://stackoverflow.com/questions/16074673/angularjs-strategy-to-prevent-flash-of-unstyled-content-for-a-class) – spender Nov 19 '16 at 17:10

1 Answers1

0

This problem is caused by the way Angular works. I guess that you are able to see the skeleton of angular (something like {{"your variable"}}) for a second and then the data is rendered to it. Your angular scripts are called once the page is loaded, so the delay in fetching data from server by your $http.get() methods causes the elements to appear without data. Thankfully, AngularJS has a simple solution to the problem in the form of ng-cloak directive. Refer the documentation for details.

https://docs.angularjs.org/api/ng/directive/ngCloak

divsingh
  • 1,172
  • 8
  • 15