Title: TagBoxComponent - Using Reactive Forms Field not updating Post by: Swany 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.
Title: Re: TagBoxComponent - Using Reactive Forms Field not updating Post by: stworthy 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']); Title: Re: TagBoxComponent - Using Reactive Forms Field not updating Post by: Swany 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); |