title: Push list of objects to another object in angularjs
body: <p>I have two separate objects which is shown below</p>
  
  <pre><code>Object1 =  [{value:'A/B'},{value:'A/B/C'},{value:'A/F'},{value:'A/'}];
  
  Object2 =[{option:'A/'},{option:'A/B'}];
  </code></pre>
  
  <p>Now i need to modify the <strong>Object2</strong> by adding a new attribute so that the Object2 must look like this</p>
  
  <pre><code> Object2 = [{option:'A/',
              directories:[{value:'A/'},{value:'A/B'},{value:'A/B/C'},{value:'A/F'}]},
             {option:'A/B',
              directories:[{value:'A/B'},{value:'A/B/C'},{value:'A/F'},{value:'A/'}]}];
  </code></pre>
  
  <p>The changes what i need is</p>
  
  <ul>
  <li><p>In directories attribute the first value should be the option value</p></li>
  <li><p>Other values should be the remaining values that should come from Object1</p></li>
  </ul>
  
  <p>I have tried the following code</p>
  
  <pre><code>angular.forEach(Object2,function(value,key){
  
   angular.forEach(Object1,function(value,key){
  
          //I need the code here
  
    });
  });
  </code></pre>