Avi banerjee

Avi banerjee

  • NA
  • 3
  • 524

After Upgrading from 1.3.15 to 1.8.2, I am getting error

Mar 12 2021 12:11 PM
1) Call from Controller- 
 1.3.15 version-
portService.getportList(opts.Name, opts.Description, opts.Text, opts.upToDays, opts.include, opts.Dept)
.success(function (data) {
$scope.allports = data;
$scope.filterports(1);
$scope.isportListLoading = false;
})
.error(function (data) {
alert(data.message);
$scope.isReportListLoading = false;
})
---------------------------------------------------------------------
Upgraded to 1.8.2 and had to update to -
portService.getportList(opts.Name, opts.Description, opts.Text, opts.upToDays, opts.include, opts.Dept)
.then(function (response) {
console.log('portListController.js');
console.log(response);
$scope.allports = response.data;
$scope.filterports(1);
$scope.isportListLoading = false;
//return $scope.allports;
})
.catch(function (data) {
alert(data.message);
$scope.isReportListLoading = false;
}
 
2) Angular Service-
 1.3.15 version-
 
rr.factory('reportService', function ($http) {
return {
getportList: function (Name, Description, Text, upToDays, include) { return $http.get('../api/ports/search', { params: { Name: Name, Description: Description, Text: Text, upToDays: upToDays, include: include } }); },
}
});
 
------------------------------------------------------ 
1.8.2 version- 
 
rr.factory('portService', function($http){
return {
getportList:
function (Name, Description, Text, upToDays, include, Dept) {
$http.get('../api/ports/search', { params: { Name: Name, Description: Description, Text: Text, upToDays: upToDays, Dept: Dept, include: include } }).then(
function (response) {
console.log(response);
console.log(response.data);
return response;
})},
}
});
 
 
After running the 1.8 Version, I am getting the below error-
 
TypeError: Cannot read property 'then' of undefined
at ChildScope.$scope.search (portListController.js:26)
at new <anonymous> (portListController.js:59333)
at Object.instantiate (angular.js:522333)
at $controller (angular.js:3)
at Object.link (angular-route.js:3333)
at angular.js:13331
at invokeLinkFn (angular.js:33333)
at nodeLinkFn (angular.js:10695)
at compositeLinkFn (angular.js:3)
at publicLinkFn (angular.js:3333) "<div class="container-fluid ng-view ng-scope" ng-hide="serverError || !currentUser.id">"
 
 
Please ignore the line numbers in the error. I have edited them....
 
Please help to resolve this.