Before opening dialog window I want to load data:
const documents = await this.documentService.loadDocuments(this.application.reglamentid);
this.documentService.setDocuments(documents);
dialog.open();
Service is:
export class DocumentService {
private documents: any[] = [];
constructor(private http: HttpClient) {}
loadDocuments(reglamentId: number): Observable<any[]> {
return this.http.get<Department[]>(`${environment.apiUrlDocuments}/Generation/documents?reglamentId=${reglamentId}`);
}
getDocuments() {
return this.documents;
}
setDocuments(documents): void {
this.documents = documents;
}
}
I want to await a response only then to open a dialog window.