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 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) " " Please ignore the line numbers in the error. I have edited them.... Please help to resolve this. |
Replies
Know the answer? Post it — somebody with the same question will find it here.