我正在尝试将所选值从HTML获取到ts文件中。下面是使用角度材料标记的HTML代码
<mat-form-field [style.visibility]="visibility" >
<mat-label>Apps</mat-label>
<mat-select #selectedApp (change)='fetchTableData($event)'>
<mat-option *ngFor="let apps of appsList$" [value]="apps.appName">{{apps.appName}}</mat-option>
<mat-option [value]="all">All</mat-option>
</mat-select>
</mat-form-field>
.ts代码
@ViewChild('selectedApp') selectedApp;
ngOnInit() {
return this.testcaseService.getAll()
.subscribe(apps => this.appsList$ = apps);
}
fetchTableData(event: any){
console.log("Selected App: "+this.selectedApp.Selected);
}
我不确定我在这里做错了什么。有人能帮我吗?
转载请注明出处:http://www.bqysc.com/article/20230526/2341886.html