How to put mat-chips inside a textarea

Asked

Viewed 76 times

0

I’m using the Material Chips Angular together with a textarea. I would like to place my Chips list inside my textarea.

Currently works as follows:

inserir a descrição da imagem aqui

I wish I had something like:

inserir a descrição da imagem aqui

My current code name:

   <div class="col-xl-3">
      <textarea class="form-control"
         #inputContasB2W
         (keyup.enter)="adicionaConta()"
         [formControl]="contasB2WControl"
         [matAutocomplete]="auto">
      </textarea>

      <mat-autocomplete autoActiveFirstOption="true" #auto="matAutocomplete">
         <mat-option (click)="adicionaConta()" *ngFor="let contaB2W of 
         contasFiltradas | async" [value]="contaB2W">
            {{contaB2W}}
         </mat-option>
      </mat-autocomplete>

   </div>

   <div class="col-xl-2">
       <mat-chip-list>
            <mat-chip *ngFor="let contaB2W of contasAdicionadasB2W; let j = index"
            selectable="false"
            removable="true"
            (removed)="removeTag(j)">
            {{contaB2W}}
            <mat-icon matChipRemove><i class="fa fa-close"></i></mat-icon>
            </mat-chip>
       </mat-chip-list>
   </div>

1 answer

-1

Try putting a event.stopPropagation(); in your Function adicionaConta($event)

  • What would be the function of Event.stopPropagation there? I think this is more a template question than TS

Browser other questions tagged

You are not signed in. Login or sign up in order to post.