angularjs - Angular JS first tutorial -


i have started learn angular js. have query regarding below code.

<html ng-app> <head> </head> </body> <h1>{{hello}} </h1> <input type="text" ng-model="hello"/> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script> </body> </html> 

query: piece of code working fine when refresh page see {{hello}} fraction of second. why?

<body ng-cloak> <h1>{{hello}}</h1>  -------- -------- -------- --------  </body> 

to prevent angular html template being displayed browser use ngcloak.

note: use ngcloak in body tag hide these thing on complete page.

the best way avaid error is, use ng-bing directive see example below.

<h1 ng-bind="hello"></h1> 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -