Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

When I call a rest service then i will get .html file from server. But it showing scripts for 1 or 2 seconds. Then it shows correct values.My problem is page loads first then controller binds data. Is there is any way to bind data before loading page? enter image description here

share|improve this question
 
Which version of angular are you using? –  ksimons 14 hours ago
add comment

2 Answers

up vote 1 down vote accepted

There are basically two options that I know of:

  1. The preferred option is to add ng-cloak to sections of the page that contain angular templates. From the docs:

    <div id="template1" ng-cloak>{{ 'hello' }}</div> <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>

  2. Use ng-bind instead of the {{ }} approach. For example:

    <div ng-bind="marked4Reviewcount"></div>

share|improve this answer
 
thanks, itz working –  Parvathy 13 hours ago
add comment

Have a look at the ngCloak directive. It temporarily hides the Angular template while the page is being loaded. You could apply it on the body tag, but it's advised to do it on portions of the page so you get a progressive loading effect.

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

share|improve this answer
 
itz not working. –  Parvathy 14 hours ago
 
Well, without knowing what you're doing, I'm taking some guesses here... 1. Is your angular script file include being done in the head section of your page? It's advised to do so in the Angular documentation.. 2. Which version of Angular are you using? –  Reinard Mavronicolas 13 hours ago
 
itz working fine using ng-bind –  Parvathy 13 hours ago
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.