Jigar Makwana
Jigar Makwana

Reputation: 227

how to hide an image when server call succeed in angularjs and html

hello i am making a demo of show and hide image on server calls,I have put a loader image on html page and put a gif file as a src,Now image is displaying,But now i want to hide it when i succeed the server call,my code is as below pls help me how to hide it,

html

<center><img src="images/plswait.gif" alt="what image shows" height="50" width="50" ng-show="show===5" ></center>

**js**


      app.controller('listingdetailController', function ($http, $scope, $compile, $filter, $sce) {

        var SearchTxt = 'cay';
        var url = encodeURI("http://www.yahoo.com");
         var page = gallery.getCurrentPage();
         var FkCategory = page.options.params;
         var lat='';
         var lng = '';
         var img = '';
         var title = '';
          var phone = '';
         var web  = '';
         var email = '';
         $scope.show5 = true;




//         console.log("===iside details======"+FkCategory);
         $scope.img = "http://caymanafterwork.netcluesdemo.com/cache/business/images/337_224/papagallo1438959641.jpg";

        $http({
            method: 'POST',
            url:  API_HOST+'/webservice/listingdetail',
            headers:
                    {
                        'Content-Type': 'application/x-www-form-urlencoded',
                        'caymanauth': caymanauth
                    },
            data: "&Catid=" + FkCategory + "&SearchTxt=" + SearchTxt,
            contentType: 'application/x-www-form-urlencoded'
        }).success(function (data)
        {
                $scope.show5 = true;

Upvotes: 0

Views: 146

Answers (2)

brute_force
brute_force

Reputation: 1171

Why don't you simply set $scope.wait = false on success function of ajax call ?

Upvotes: 0

vvs
vvs

Reputation: 1076

Have you checked this question - AngularJS: ng-show / ng-hide. It offers snippets on how to hide the image.

You already have a success function. All you need to do write some code to set the value of variable which is bound to the relevant image. Do this in the success function.

Upvotes: 1

Related Questions