Angularjs solve the data show a flash of the problem? -Solutions

Source: Internet
Author: User

Transferred from: https://www.cnblogs.com/e0yu/p/7219930.html?utm_source=itdadao&utm_medium=referral#undefined

When using angular JS, put AngularJS at the bottom of the file, when the page is rendered, there will be a flash of the situation:

Workaround one : Use Ng-cloak

<style type= "Text/css" >[ng-cloak]{display:none;} </style><body ng-app ng-init= "Name= ' Zhang San '" ng-cloak> {{name}}</body><script type= ' text/ JavaScript ' src= ' bower_components/angular/angular.js ' ></script>

Because execution is fast, the usual practice is to control it through classes:

<style type= "Text/css" >[ng-cloak],.ng-cloak{display:none;} </style><body ng-app ng-init= "Name= ' Zhang San '" class= "Ng-cloak" > {{name}}</body><script type= ' text/ JavaScript ' src= ' bower_components/angular/angular.js ' ></script>

Solution Two : Put the introduction of angular.js in front of head and load it in advance;

workaround three : Use Ng-bind

<body ng-app ng-init= "Name= ' Zhang San '" ng-bind= "name" ></body><script type= ' text/javascript ' src= ' Bower_ Components/angular/angular.js ' ></script>

Angularjs solve the data show a flash of the problem? -Solutions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.