title: Patch Request to API in Angular 6 Updating only the Last Item in Object Array
body: <p>I have a football team with player names and details. I open a model in order to edit the player's details.</p>
  
  <p>When I set new data which then fires a patch request, the data seems to edit the last item in the object array and not the specific item I am editing.</p>
  
  <p>I have a really rudimentary setup in my component, whereby the patch gets sent from there instead of my service, but for now, I just need to see it work. I can set this up properly later on.</p>
  
  <p>Any ideas as to why this might be happening?</p>
  
  <p><strong>I have a feeling it might be the loop?</strong></p>
  
  <pre><code>getHomeTeam(): void {
  this.HometeamService.getHomeTeam().subscribe(hometeam =&gt; {
    this.hometeam = hometeam;
      for (let i =0; i &lt; hometeam.length; i++) {
       this.player_id = hometeam[i].id;
      }
    });
  }
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>So the fix was pretty simple, thanks to @robert's help, I needed to pass hometeam.id into the patch request instead of this.player_id</p>
  
  <pre><code>updatePlayer(hometeam) {
  let player_id = hometeam.id;
  this.http.patch('https://sidelineapp.io/demo/api/1.1/tables/home_team/rows/' + hometeam.id, hometeam).subscribe(status =&gt; {
    console.log(hometeam.id);
    this.getHomeTeam();
    this.ngxSmartModalService.close('playerModal');
  });
  </code></pre>
  
  <p>}</p>
  
  <p>The modal data is rendering correctly, so pretty sure it isn't in the view, but happy to share the form if this might be the issue.</p>
  
  <p>Any help would be greatly appreciated. </p>