Analysis of the Solution to the Flicker Problem of Angularjs before Initialization

  • 2021-07-09 06:48:06
  • OfStack

In this paper, an example is given to solve the flicker problem when Angularjs is not initialized. Share it for your reference, as follows:

Method 1:

Use the ng-cloak directive, use the directive in the area where the data is bound, and set the style of the directive to hide, as follows:

Html:


<body ng-controller="QuberController" ng-cloak class="ng-cloak">

Css:


.ng-cloak { display: none; }

Method 2:

Use the ng-bind directive instead of {{item. name}}, as follows:

{{item. name}} → < span ng-bind="item.name" > < /span >

Method 3:

Use the resolve attribute (see: https://www. ofstack. com/article/80523. htm)

I hope this article is helpful to everyone's AngularJS programming.


Related articles: