Hi,

On page load, I'm calling a controller, in which im getting data from HTTP 
POST service mentioned below

But as a result a page will be loaded and later after a while(1min) data 
will be populated into the page. I want it to be avoided as wait until data 
is arrived from the controller and then load the page.

My code
HTML contents:

<div id="scroller" data-ng-controller="myCtrl" data-ng-init="init()">
  <div ng-repeat="x in variable ">  
<ul>
  <li class="strong" >{{ x.shortMsg }}</li>
  <li class="content">{{ x.validity }}<br /></li>
 <li  class="icon"><img src="{{ x.image }}"</li>
</ul>
</div>
        
            </div>

Script contents:

function myCtrl($scope, $window,$http) {
    $scope.variable = "Hello";
    alert("calculaing data.. please wait");
    
    $scope.init = function () {

      alert($scope.variable)
     $http({
             method: 'POST', url: '/citibank/compressedDetails',
             data: $scope.variable
           }).
             success(function(data, status, headers, config) {
              // $window.location.replace('./confirm.html');
              $scope.variable=data;
             // $scope.firstName=data;
             }).
             
    };
    
}



-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to