What do I have to write tu push an chip name into the array?


#1

I want to add a new Ion-chip when clicking the +button. But what do I have to write here : this.tagName.push(); /// I mean into the brackets. Because tagName doesn’t work.

HTML

<ion-chip #chip *ngFor="let tag of tagName">

  <ion-label>{{tag.tag}}</ion-label>
  <button ion-button clear color="dark" (click)="remove(chip)">
    <ion-icon name="close-circle"></ion-icon>
  </button>
</ion-chip>

<button class="buttonIcon" ion-button small round icon-only (click)="add(chip)">  <!--When "add" button is pressed -> opens searchbar (not done yet)-->
  <ion-icon name="add"></ion-icon>
</button>

TS

public tagName = [
    {
      "tag": "#men"
      
    },
  ];

 add(chip: Element) {
    this.tagName.push();

  }