Angular%20JS%20Interview%20Questions%20and%20Answers
Question: How will you display inprogress revolving image to indicate that RESTful data is bing loaded?Answer:<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?
Yes
No
Most helpful rated by users:
- What is AngularJS?
- Tell me does Angular use the jQuery library?
- Tell me can we use the open-source Closure Library with Angular?
- Why is this project called "AngularJS"? Why is the namespace called "ng"?
- Can you please explain what is testability like in Angular?