我最近开始使用 Angular4 反应式表单,我想创建一个基于以下结构的表单数组
"ContactPoints":
[{"ContactPointID":33,"EntityID":9,"System":"phone","Value":"1234567890","Use":"work","Rank":1,"InUseStart":"2017-07-14T00:00:00","InUseEnd":"2017-10-22T00:00:00"},
{"ContactPointID":34,"EntityID":9,"System":"phone","Value":"1234567890","Use":"home","Rank":1,"InUseStart":"2017-07-14T00:00:00","InUseEnd":"2017-10-22T00:00:00"},
{"ContactPointID":35,"EntityID":9,"System":"fax","Value":"1234567890","Use":"work","Rank":1,"InUseStart":"2017-07-14T00:00:00","InUseEnd":"2017-10-22T00:00:00"},
{"ContactPointID":36,"EntityID":9,"System":"email","Value":"kishore@abc.com","Use":"work","Rank":1,"InUseStart":"2017-07-21T00:00:00","InUseEnd":"2017-10-29T00:00:00"},
{"ContactPointID":37,"EntityID":9,"System":"email","Value":"kishore@abc.com","Use":"home","Rank":1,"InUseStart":"2017-07-21T00:00:00","InUseEnd":"2017-10-29T00:00:00"}],
下面是 HTML 语法,我需要在值和系统中获取各自的输入值,并且使用将是基于系统的硬编码值和验证,实现这一点的任何建议都将非常有帮助
<div class="col-md-4" formArrayName="ContactPoints">
<div class="form-group form-group-default " formGroupName=0>
<label class="control-label">Main Number</label>
<input type="text" class="form-control" formControlName="Value">
</div>
</div>
<div class="col-md-4" formArrayName="ContactPoints">
<div class="form-group form-group-default " formGroupName=1>
<label class="control-label">Main Number</label>
<input type="text" class="form-control" formControlName="Value">
</div>
</div>