Combine image upload ajax with form submit ajax
<p>I have image upload ajax like this</p>

<pre><code>$scope.uploadFile = function(){
    var file = $scope.myFile;
    console.log(file);
    var uploadUrl = "/api/upload_image";//It will also goes to '/api/get_data'
    //fileUpload.uploadFileToUrl(file, uploadUrl);
    var fd = new FormData();
    fd.append('file', file);
    $http.post(uploadUrl, fd, {
        transformRequest: angular.identity,
        headers: {'Content-Type': undefined}
    })
    .success(function(e){
        console.log("Success");
    })
    .error(function(e){
        console.log("Error");
    });
};
</code></pre>

<p>And calling submit form ajax like this.</p>

<pre><code>$http({
    url: "/api/get_data",
    method: "POST",
    dataType:"json",
    data:JSON.stringify(this.formData)
}).success(function(data) {
    console.log("Success");      
}).error(function(error) {
    console.log("Error");
});
</code></pre>

<p>Both are working but separately, How to combine these two ajax into one, that is submit ajax, the second one.</p>

<p>Or is there any way to post image data in second ajax, I am using angular+laravel5.2</p>

<p>My file input in angular view is </p>

<pre><code>&lt;input type="file" file-model="myFile"&gt;
</code></pre>

<p>Thanks.</p>