我的Angular js代码在本地服务器中正常工作,但突然在实时服务器中不工作。实时服务器一个月前开始工作,突然停止工作。
我的代码
<script type="text/javascript">
angular.module('controllers', []);
angular.module('app', ['controllers', 'ui.bootstrap', 'angularUtils.directives.dirPagination']);
angular.module('controllers')
.controller('MainCtrl', function ($scope, $element, CommonService, $timeout) {
$scope.index = 0;
$scope.tables = [];
$scope.canShowDrop = false;
$scope.country = "Select Country";
$scope.dateFormat = 'dd-MM-yyyy';
$scope.startDatePopup = {
opened: false
};
$scope.endDatePopup = {
opened: false
};
$scope.OpenStartDate = function () {
$scope.startDatePopup.opened = !$scope.startDatePopup.opened;
};
$scope.OpenEndDate = function () {
$scope.endDatePopup.opened = !$scope.endDatePopup.opened;
};
$scope.Search = function () {
CommonService.GetData($scope);
};
$scope.ChangeCountry = function (name) {
$scope.country = name;
CommonService.GetData($scope);
}
$scope.exportToExcel = function (tableId) {
CommonService.ExportData($scope);
return false;
}
$scope.ShowDrop = function () {
$scope.canShowDrop = true;
}
$scope.HideDrop = function () {
$scope.canShowDrop = false;
}
$scope.ExcludedColumns = function (column) {
return !(column == 'JoiningDate' || column == 'Total');
};
CommonService.GetData($scope).then(function () {
$scope.countrylist = $scope.tables[0].cols;
});
})
.service('CommonService', function CommonService($http, $q) {
var service = {};
service.GetData = GetData;
service.ExportData = Export;
return service;
function GetData($scope) {
var paramStartDate = $scope.StartDate ? $scope.StartDate : "";
var paramEndDate = $scope.EndDate ? $scope.EndDate : "";
var payload = { 'selectedCountry': $scope.country, 'startDate': paramStartDate, 'endDate': paramEndDate, 'isExport': 'false' };
var params = {};
params.method = "POST";
params.url = "DailyReport.aspx/GetDailyReport";
params.data = JSON.stringify(payload);
params.contentType = "application/json; charset=utf-8";
params.dataType = "json";
return $q.all([
$http(params).then(function (response) {
return response.data.d;
})
]).then(function (results) {
var jsonData = results[0];
$scope.tables = [];
$scope.tables.push({ rows: jsonData, cols: Object.keys(jsonData[0]) });
});
}
function Export($scope) {
var paramStartDate = $scope.StartDate ? $scope.StartDate : "";
var paramEndDate = $scope.EndDate ? $scope.EndDate : "";
var payload = { 'selectedCountry': $scope.country, 'startDate': paramStartDate, 'endDate': paramEndDate, 'isExport': 'true' };
var params = {};
params.method = "POST";
params.url = "DailyReport.aspx/GetDailyReport";
params.data = JSON.stringify(payload);
params.contentType = "application/json; charset=utf-8";
params.dataType = "json";
return $q.all([
$http(params).then(function (response) {
return response.data.d;
})
]).then(function (results) {
var jsonData = results[0];
__doPostBack('Export', JSON.stringify(jsonData));
});
}
})
.filter('jsonDate', ['$filter', function ($filter) {
return function (input, format) {
var objDate = new Date(input.match(/\d+/)[0] * 1);
return (objDate) ? $filter('date')(objDate, format) : '';
};
}]);
</script>