title: Loop through an two arrays simultaneously and pass a first element of each array to the function at a time using angular js [new to angular]
body: <pre><code>vm.array1.push(content1);
  vm.array2.push(content2);
  </code></pre>
  
  <p>I have a above two arrays with a data of objects pushed at each time and the data modal of each array looks like this</p>
  
  <pre><code>vm.array1=[object1,object2,object3]
  vm.array2=[object1,object2,object3]
  </code></pre>
  
  <p>I need to pass only object of first element of array1 with the object of first element of array2 to the function.</p>
  
  <pre><code>vm.save(a,b){
  //save functionality success by calling API
  }
  </code></pre>
  
  <p>variables a,b should contain only the first elements of both the array simultaneously followed by second elements then third...</p>
  
  <p>How can i pass only objects but not arrays to the function using angularJS? </p>