title: Angular How to dynamically change a value from an Array
body: <p>I have some code that I am working on, that allows a user to pick a contact, I want the code to be able to populate an array,</p>
  
  <p>as that then populates the Html template with NgFor</p>
  
  <p>However, I am battling to make the function change data in the array dynamically
  could anyone help me or at least point me into a direction.</p>
  
  <p>here is the relevant code
  html file</p>
  
  <pre><code>&lt;ion-list&gt;
  
    &lt;ion-grid&gt;
      &lt;ion-row&gt;
        &lt;ion-col&gt;
          &lt;ion-item-group (click) = "pickContact()"  *ngFor="let contacts of mContacts"&gt;
            &lt;ion-card&gt;
                &lt;ion-item lines = "none"&gt;             
                    &lt;ion-label class="ion-text-wrap"&gt;Name: {{contacts.name}}&lt;/ion-label&gt;        
                  &lt;/ion-item&gt;
                  &lt;ion-item lines = "none" &gt;
                    &lt;ion-label class="ion-text-wrap"&gt;Number: {{contacts.number}}&lt;/ion-label&gt;
                  &lt;/ion-item&gt;       
            &lt;/ion-card&gt;            
          &lt;/ion-item-group&gt;    
  
        &lt;/ion-col&gt;
      &lt;/ion-row&gt;
  
    &lt;/ion-grid&gt;
  &lt;/ion-list&gt;
  </code></pre>
  
  <p>I want the function pickContact to be called when the card is selected and then populate the corrosponding element in the array.
  ts file</p>
  
  <pre><code>export class ContactComponentComponent implements OnInit {
  
    constructor(private contacts: Contacts) { }
  
  
    mContacts = [
     {
      name: [''],
      number: ['']
     },
     {
      name : ['Carl'],
      number: ['065 623 4567']
     }
    ];
  
    ngOnInit() {}
  
  //currently thows an error:  
  //Property 'name' does not exist on type '{ name: string[]; number: string[]; }[]'.
  
  //Property 'number' does not exist on type '{ name: string[]; number: string[]; }[]'
  
    pickContact() {
      this.contacts.pickContact().then((contact) =&gt; {
      this.mContacts.name = contact.name.givenName;
      this.mContacts.number = contact.phoneNumbers[0].value;
      });
    }
  
  }
  
  </code></pre>