is there a way to detect the valueChanges for formArray which has been dynamically binded from array of objects in angular8

前端 未结 1 676
我在风中等你
我在风中等你 2021-01-26 12:31

is there a way to detect if there are any valueChanges for the toggle buttons made to form array which has been binded from dynamic array of objects.

Here, i am getting

相关标签:
1条回答
  • 2021-01-26 13:09

    the problem is that you has any FormArray.

    //this has no sense
    this.FB.array([this.detailsToogle]) 
    

    Do you want to write ?

    this.FB.array(this.detailsToggle.map(x=>this.FB.group(x)))
    

    This is a FromArray of FormGroups

    Any way, if you only want to change the boolValue, you don't need create a formArray so complex, you can simply

    this.FB.array(this.detailsToggle.map(x=>x.boolValue))
    

    this is FormArray of FormControls

    When you has an FormArray is for manage a FormArray. You has some too complex as

    <input type="checkbox" [checked]="toggleValue.boolValue" (change)="toggleValue.boolValue = $event.target.checked">
    

    when can be like,e.g. is is a FromArray of FormControls

    <input type="checkbox" [formControlName]="i"> 
    

    Really, you need ask you what data you want get and what data you want change. Tip: Before write nothing in your .html write

    <pre>
    {{agentSettingsInfoForm.?value |json}}
    </pre>
    
    0 讨论(0)
提交回复
热议问题