Skip to main content
deleted 1 characters in body
Source Link

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest($scope.url).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<`div<div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>`div>

When Youyour application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest($scope.url).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<`div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>`

When You application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest($scope.url).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>

When your application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.

Post Made Community Wiki by Svetlana Ivanova
added 3 characters in body
Source Link

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest(loadUrl$scope.url).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<`div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>`

When You application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest(loadUrl).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<`div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>`

When You application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest($scope.url).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<`div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>`

When You application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.

Source Link

If i correct understand you, you should doing it like this:

 var app = angular.module('YourModule', []);
    app.factory("serviceHttp", function($http) {
        var serviceHttp={};
    
        serviceHttp.yourGetRequest = function(yourUrl) {
         
           return $http.get(yourUrl);
       };
       
        return serviceHttp;
    });

And for example, controller:

        var Controller = function($scope,serviceHttp) {
        $scope.varX='';
        $scope.loading = true;
      var returnArr = serviceHttp.yourGetRequest(loadUrl).success(function(dataFromServer) {
$scope.loading = false;
$scope.varX = dataFromServer;
})

};

in view you can use ng-show, like this:

<`div ng-show="loading" class="loading"><img src="../styles/ajax-loader-large.gif"></div>`

When You application start loading, $scope.loading = true and this div shown, and when you get response from server $scope.loading became false and div doesn't show.