title: how to map an array to another array with different values (angularJs)
body: <p>Currently I am trying to use an existing array to map it to another array in order to match what the server wants. </p>
  
  <p>for example...</p>
  
  <p>I have an array:</p>
  
  <pre><code>$scope.users = [{
          "firstName": "john",
          "middleName": null,
          "lastName": "doe",
          "registrationNumber": "334"
      },
      {
          "firstName": "paul",
          "middleName": null,
          "lastName": "dean",
          "registrationNumber": "223"
      },
      {
          "firstName": "andrew",
          "middleName": null,
          "lastName": "mac",
          "registrationNumber": "132"
      }
  ]
  </code></pre>
  
  <p>however I want it to look like this...</p>
  
  <pre><code>[{
      name: "john doe",
      value: {
          registration: 334,
          last: "doe",
          first: "john"
      }
  }]
  </code></pre>
  
  <p>So what I've been doing is something like this to map it out...but it only gets the first one.</p>
  
  <pre><code>var list = [{
      name: $scope.users[0].firstName + ' ' + $scope.users[0].lastName,
      value: {
          registration: $scope.users[0].registrationNumber,
          first: $scope.users[0].firstName,
          last: $scope.users[0].lastName
      }
  }];
  </code></pre>
  
  <p>I tried to use <code>angular.forEach</code> to get all the list and push it...but hasn't really worked too well yet... any help would be great!</p>