Within my .html file, the following code is present: The button labeled Data Import is displayed....
<button mat-menu-item (click)="download()">
<mat-icon>cloud_download</mat-icon>
<span>Data Import</span>
</button>
In the component.ts file:
I have defined a function that should be executed upon clicking the button:
constructor(
private downloadService: DownloadService
)
download(){
this.downloadService.getDownload();
}
In the downloadservice.ts file:
A service has been created to make a backend API call to /Download.
export class DownloadService {
etext : String;
baseUrl: string = environment.apiUrl + '/Download';
constructor(private http: HttpClient) { }
getDownload() {
return this.http.get(this.baseUrl);
this.etext="The operation has been done";
}
}
When attempting to click on the Data Import button, no action is triggered and no event is recorded.