Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我试图编辑表格中的单元格,我的表格是nxn矩阵,对角线两侧的值相似_Javascript_Angular_Matrix_Angular Reactive Forms - Fatal编程技术网

Javascript 我试图编辑表格中的单元格,我的表格是nxn矩阵,对角线两侧的值相似

Javascript 我试图编辑表格中的单元格,我的表格是nxn矩阵,对角线两侧的值相似,javascript,angular,matrix,angular-reactive-forms,Javascript,Angular,Matrix,Angular Reactive Forms,使用角度反应形式,我根据所选复选框的数量生成nxn矩阵表。但是我想编辑两边都有相同值的表格单元格,这可以通过在相反单元格上使用双向绑定来完成。所有对角线值均为1,不可编辑 代码到目前为止 <div class="form-group"> <table *ngIf="showTable" class="table table-striped table-bordered" style="width:50%;" formControlName

使用角度反应形式,我根据所选复选框的数量生成nxn矩阵表。但是我想编辑两边都有相同值的表格单元格,这可以通过在相反单元格上使用双向绑定来完成。所有对角线值均为1,不可编辑

代码到目前为止

  <div class="form-group">
       <table *ngIf="showTable" class="table table-striped table-bordered" 
          style="width:50%;" formControlName="correlations">
            <thead>
                 <tr>
                      <th *ngFor="let parameter of checked">{{parameter}}</th>
                 </tr>
             </thead>
             <tbody>
                  <tr *ngFor="let row of correlationValues">
                       <td contenteditable="true" style="background-
                           color:#b1dbf9" *ngFor="let col of row">{{col}}</td>
                  </tr>
             </tbody>
       </table>
   </div>

{{参数}}
{{col}}
列值来自选中的复选框值

创建矩阵的代码

createMatrix(n:number) {
    var innerArr;
   this.correlationValues = [];

    for (var i=0; i<n; i++){
        innerArr = [];
        for (var j=0; j<n; j++) {
            innerArr.push((i+j+1)%2);
        }
        this.correlationValues.push(innerArr);
    }
    console.log(this.correlationValues.toString());
    return this.correlationValues;
}
createMatrix(n:number){
var innerArr;
this.correlationValues=[];

对于(var i=0;这是解决此类问题的角度方法,请使用jquery