Search code examples
javascriptangularjsmean-stack

Submitting forms with different controllers


I have these two forms for submitting data to newsfeed table, one is: controller for image path, and second is for: newsfeed content. Then I want to submit these two forms in one click and submit the first form than the second form (submit form one at a time)

<form id="form1" ng-submit="Submit();">
</form>

<form id="form2" ng-submit="newsfeed.regNewsfeed(regData);">
</form>

Solution

  • Yeah just use:

    $scope.submitBothForms = function() {
      $scope.Submit().then(function() {
        newsfeed.regNewsfeed($scope.regData)
      })
    }