Angular formGroupName无法检测到formgroupname-> index->​​ controlname

时间:2018-10-18 05:38:41

标签: angular

this.peersForm = this.formBuilder.group({
     orgPeersData:this.formBuilder.array([
      this.PeersData()
     ])
 });
<form [formGroup]="peersForm">
       <div formArrayName="orgPeersData">
          <table class="table table-striped">
             <thead>
                <th><input type="checkbox"></th>
                <th>Peer</th>
                <th>Organisation Name</th>
                <th>Ip Address</th>
                <th>User Name</th>
                <th>Password</th>
                <th>Check Connection</th>
                <th>Status</th>
             </thead>
             <tbody *ngFor="let orgs of categoryList">
                <tr [formGroupName]="peer.peer" *ngFor="let peer of orgs.peers; let i=index">
                <td><input type="checkbox"></td>
                <td>
                   <p>{{peer.peer}}</p>
                </td>
                <td>
                   <p>{{orgs.org_name}}</p>
                </td>
                <td class="editable"><input contenteditable = "false" id="focusme" formControlName="host">
                   <i class="fa fa-pencil" (click)="editMe()"></i>
                </td>
                <td class="editable"><input  contenteditable = "true"  formControlName="user">
                   <i class="fa fa-pencil"></i>
                </td>
                <td class="editable"><input contenteditable = "true" formControlName="password"><i class="fa fa-pencil"></i></td>
                <td><button class="btn btn-success iconbtn" (click) ="checkConnection()">Check</button></td>
                <td>
                   <p class="status">Pending</p>
                </td>
                </tr>
             </tbody>
          </table>
       </div>
    </form>
"peer_orgs":[
          {
             "org_name":"org1",
             "org_domain":"org1.com",
             "peer_count":2,
             "peers":[
                {
                   "peer_id":"peer0.org1org2.com",
                   "peer":"peer0"
                },
                {
                   "peer_id":"peer1.org1org2.com",
                   "peer":"peer1"
                }
             ]
          },
           {
             "org_name":"org2",
             "org_domain":"org2.com",
             "peer_count":2,
             "peers":[
                {
                   "peer_id":"peer0.org2.com",
                   "peer":"peer0"
                },
                {
                   "peer_id":"peer1.org2.com",
                   "peer":"peer1"
                }
             ]
          }
       ],

我收到此错误:

  

找不到路径为“ orgPeersData-> peer0”的控件

0 个答案:

没有答案