How to bind chiplist to textarea

We need to convert the text selected from listbox to chips and those chips should be added dynamically to textarea on selection of text from listbox. How to achieve this?


3 Replies

KR Keerthana Rajendran Syncfusion Team October 7, 2021 06:21 AM UTC

Hi Bhagyasri, 

Thanks for contacting Syncfusion support.  

Based on your query, we suspect that you would like to choose an item from the list and that selected item should be displayed in the form of Chip. If so, EJ2 MultiSelect component might suit your requirement.  

Refer to the following demo and UG links for more details on this scenario. 



Please check whether the above links help you. If not, kindly elaborate on your exact use case scenario(whether you need to move the list item as Chip within textarea) with a pictorial representation(if possible) which will be helpful to guide you in a better way.  

Regards, 
Keerthana R. 



BH Bhagyasri replied to Keerthana Rajendran October 7, 2021 12:24 PM UTC

Hi Keerthana,

Thank You for your reply.

As attached below, the scenario required is on selection of particular item from listbox control (ejs-listbox), it should be converted to chip, and that chip should be added dynamically (on selection from listbox) to beside textarea.

How to achieve this?




SM Shalini Maragathavel Syncfusion Team October 8, 2021 11:44 AM UTC

Hi Bhagyasri, 

Good day to you. 

We checked your requirement to dynamically create the Chip component for the selected items of the ListBox. You can achieve this requirement by adding the selected items of the ListBox in the ChipList using add method of Chip in the change event of ListBox as demonstrated in the below code snippet. 

App.component.html 
 
<div class="col-lg-12 control-section"> 

    <ejs-listbox [dataSource]="data" (change)="select($event)"></ejs-listbox> 

    <ejs-chiplist #chip enableDelete="true"></ejs-chiplist> 
</div> 
---------------------------------------------------
App.component.ts 
export class AppComponent { 

  public select(args) { 
    var addChip = args.value; 
    this.chip.add(addChip);  //appending chiplist in chip 
  } 
} 

Please find the below sample for your reference,

Sample:
https://stackblitz.com/edit/angular-kdafrg-mc4zbc?file=app.component.html 


Please get back to us if you need any further assistance. 

Regards, 
Shalini M. 



Loader.
Up arrow icon