Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Angular JS Interview Questions and Answers

Ques 21. How will you display inprogress revolving image to indicate that RESTful data is bing loaded?

<div ng-show="loading">
 <img class="loading" src="portal/images/loading_32.gif" />
</div>

 $scope.loadReportData = function($http) {
 $scope.loading = true;  // start spinng the image
 $http(
   {
    method : 'GET',
    url : propertiesService.get('restPath')
      + '/myapp/portfolio/'
      + $scope.clientId
      + '/'
      + dateService
        .userToRest($scope.reportDate),
    cacheBreaker : true
   }).success(
   function(data, config) {
    $scope.reportData = data;
    portal.log('reportData: ',
      $scope.reportData);
    $scope.loading = false;   // stop spinning the image
   }).error(
   function(data, status, headers, config) {
    if(data.errorMsg != null) {
     $scope.httpError = data.errorMsg;
    }
    else {
    $scope.httpError = "Error retrieving data from " + errorService
      .getApacheErrorTitleMessage(status,
        data, config);
       }
    $scope.loading = false;  // stop spinning the image
   });

};

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook