EasyUI Forum
December 14, 2024, 04:30:49 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: TagBoxComponent - Using Reactive Forms Field not updating  (Read 10642 times)
Swany
Newbie
*
Posts: 44


View Profile Email
« on: November 27, 2018, 05:47:55 PM »

I have a dialog with a eui-tagbox, which currently has 2 tag in it. I am using Reactive Forms and when I update the value by adding another string to it with a button click. I am adding it to the array which is defined as the value for the FormControl. The tag does not appear in the field for the new value. I have verified the string value was add and is the FormControl value.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 27, 2018, 06:17:40 PM »

You should get the form control and call 'setValue' method to set the new value. Please try this code:
Code:
<eui-tagbox formControlName="tag"></eui-tagbox>
this.user.get('tag').setValue(['tag1','tag2']);
Logged
Swany
Newbie
*
Posts: 44


View Profile Email
« Reply #2 on: November 28, 2018, 08:38:43 AM »

I figured it out. I needed to clear the array value in the FormControl first, before add the array back into the control.
Code:
        this.attachmentList = [];
        this.attachmentList = this.editData.get('attachmentList').value;
        this.attachmentList.push(title);
        this.editData.get('attachmentList').setValue([]);
        this.editData.get('attachmentList').setValue(this.attachmentList);   


 
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!