Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. $scope.sendValues = function () {
  2. MyService.function1($scope.value1, $scope.value2);
  3.  
  4. for(var i = 0; i < $scope.arr.length; i++) {
  5. $scope.value3 = $(".input" + i).val();
  6. MyService.function2($scope.value3);
  7. }
  8. };
  9.  
  10. var tempID = 0;
  11.  
  12. var function1 = function (value1, value2) {
  13. return $http({
  14. method: 'POST',
  15. url: "someUrl",
  16. data: {
  17. valeu1: value1,
  18. value2: value2
  19. }
  20. }).success(function (response) {
  21. tempID = response.data.id;
  22. });
  23. };
  24.  
  25. var function2 = function (value3) {
  26. return $http({
  27. method: 'POST',
  28. url: "anotherURL",
  29. data: {
  30. value3: value3,
  31. tempID: tempID
  32. }
  33. });
  34. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement