Angularjs 无法使用Angular9传递数据

Angularjs 无法使用Angular9传递数据,angularjs,angular-ngmodel,angular-ng-if,angular-bootstrap,Angularjs,Angular Ngmodel,Angular Ng If,Angular Bootstrap,我有一个从后端获取数据的数组。数据应该是这样的 UI 使用以下代码将上述数据绑定到表 HomeComponent.html <table class="table table-hover" id =jres> <thead> <th *ngFor="let col of columns"> {{col}} <

我有一个从后端获取数据的数组。数据应该是这样的

UI 使用以下代码将上述数据绑定到表

HomeComponent.html

<table class="table table-hover" id =jres>     
          <thead>
            <th *ngFor="let col of columns">
              {{col}}
            </th>
          </thead>
          <tbody>
            <tr *ngFor="let jre of jreArray">
                <ng-container *ngFor="let col of index" >
                    <td *ngIf='col !=="location"'>{{jre[col]}}</td>
                    <td *ngIf='col ==="location"' ><input class="btn btn-default" type="submit" value="Download" (click) ="download()"></td>
                </ng-container>             
          </tbody>
      </table>

{{col}}
{{jre[col]}
HomeComponent.ts

export class HomeComponent implements OnInit {

  constructor(private rs:RestService,private service:JreServiceService) { 
   
  } 
  columns= ["ID","JRE Name","Base Package","Download"];
  index=["id","jrename","basepackage","location"]
  jreArray: Array<IJre> = [];
  searchkey: any;
  path:any;

  ngOnInit(): void {
    this.service.getAllJre().subscribe(data=>{
      this.jreArray =  data;
      console.log(data)
    });
  }
 
  download(){
    alert(this.path)
    this.service.download(this.path).subscribe(data=>{
      this.jreArray = data;
    })
  }
}
导出类HomeComponent实现OnInit{
构造函数(私有rs:RestService,私有服务:JreServiceService){
} 
列=[“ID”、“JRE名称”、“基本包”、“下载”];
索引=[“id”、“jrename”、“basepackage”、“location”]
jrrarray:Array=[];
搜索键:任何;
路径:任意;
ngOnInit():void{
this.service.getAllJre().subscribe(数据=>{
this.jrrarray=数据;
console.log(数据)
});
}
下载(){
警报(this.path)
this.service.download(this.path).subscribe(数据=>{
this.jrrarray=数据;
})
}
}
我需要在单击下载按钮时将位置值传递给component.ts。我尝试了以下逻辑

1.1模型

2.使用下面的代码将值直接传递给方法

 <td *ngIf='col
    ==="location"' ><input class="btn btn-default" type="submit" value="Download" (click) ="download(jre[col])"></td>

有什么简单的方法可以解决这个问题吗。
请对此给出建议。

我做了以下更改。现在我可以通过该位置了

<tbody>
            <tr *ngFor="let jre of jreArray">
              <td >{{jre.id}}</td>
              <td >{{jre.jrename}}</td>
              <td >{{jre.basepackage}}</td>
              <td ><input class="btn btn-default" type="submit" value="Download" (click) ="download(jre.location)"></td>       
          </tbody>

{{jre.id}
{{jre.jrename}
{{jre.basepackage}