I am trying to get the selected value from HTML into ts file . Below is the HTML code which uses Angular material tags
<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 code
@ViewChild('selectedApp') selectedApp;
ngOnInit() {
return this.testcaseService.getAll()
.subscribe(apps => this.appsList$ = apps);
}
fetchTableData(event: any){
console.log("Selected App: "+this.selectedApp.Selected);
}
I am not sure what am i doing wrong here . Can anyone help me