angularjs - How to copy a list before POST/GET block execution? -
i trying copy list present in post body before execution of post block.
below code snippet:
app.controller('oneclickcontroller',function($scope,$http){ $scope.oneclick.submitoneclickdetails.listinvestoptions ={}; $scope.oneclick.submitoneclickdetails.contactdtlswrapper.contactdtls = {}; $scope.invest = {}; $scope.submitoneclick = function(investdtls) { //$scope.oneclick.submitoneclickdetails.contactdtlswrapper.contactdtls.emailaddr = angular.copy('mbc@gmail.com'); //$scope.invest = angular.copy(investdtls); $scope.oneclick.submitoneclickdetails.listinvestoptions = angular.copy(investdtls); $http({ method : 'post', url : '/investor/api/v1/oneclick', data : $scope.oneclick }).success(function(response) { $scope.out= response; alert("success " + $scope.oneclick.submitoneclickdetails.listinvestoptions[0].investname); }); } });
here list investdtls getting copied listinvestoptions.
but problem ,the controller not called means
$http({ method : 'post', url : '/investor/api/v1/oneclick', data : $scope.oneclick })
above block not executing @ can check copied values in alert statement printing inside success block.
at same time if copying normal string value like:
$scope.oneclick.submitoneclickdetails.contactdtlswrapper.contactdtls.emailaddr = angular.copy('mbc@gmail.com');
it getting copied , controller called ,inside can check updated emailaddr value.
i can not see errors in console also.
most importantly, if copying temp list not part of post body, copy successful , controller called.
$scope.invest = angular.copy(investdtls);
any welcome.
Comments
Post a Comment