Search Posts

Pop window does not closes after calling hide also in Angular JS

This is my function

(function(){
             'use strict';
       function TablePopUpController($http, prod, tableName, $mdDialog, $scope,$timeout,$location) {
             $scope.tableName=tableName;
             var datas=[];
             //$location.reload();
             $scope.submitData = function() {
                    if (tableName == 'WFSmartPriority') {
                           var url = prod.TrfUrl + "/GetWFSmartPriority?tableName="
                                        + tableName + "&OrgID=" + $scope.OrgID+"&"+prod.TrfApiKey+"&callback=JSON_CALLBACK";
                           $http.jsonp(url).success(function(data) {
                                 datas=data.GetWFSmartPriorityResult;
                           //     console.log(datas);


                                 hideData(datas);// Calling function to hide pop ip 


                           });

                    } else {
                           if($scope.market==undefined)
                                 $scope.market=' ';
                           if($scope.OrgID==undefined)
                                 $scope.OrgID=0;
                           if($scope.userGroupID==undefined)
                                 $scope.userGroupID=0;
                           var url = prod.TrfUrl
                                        + "/GetWFMarketOrgUserGroup?tableName=" + tableName
                                        + "&OrgID=" + $scope.OrgID + "&Market="
                                        + $scope.market + "&UserGroupID="
                                        + $scope.userGroupID+"&"+prod.TrfApiKey+"&callback=JSON_CALLBACK";
                           $http.jsonp(url).success(function(data) {
                                 datas=data.GetWFMarketOrgUserGroupResult;
                                 console.log(datas);
                                 hideData(datas);
                           });
                    }

             }


             function hideData(data){
                    //$mdDialog.cancel(data);
$mdDialog.hide(data);
                    console.log('after hide');


             }

       }
             angular.module('celeritas').controller(
             'TablePopUpController',['$http', 'prod', 'tableName', '$mdDialog', '$scope','$timeout','$location',TablePopUpController]
             )
})();

After ajax success i am calling $mdDialog.hide(data); but then also it does not closes the pop up window .

When i refresh and do something it closes second time .
I dont know what am i missing .

I debugged also all looks fine.I get data value also but pop window it does closes .

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *