Answer the question
In order to leave comments, you need to log in
How to wait for a response from the server?
There is a class with DI dependencies:
export class DocumentsSettings implements Settings {
constructor(
public filtersRepository: DocumentsFiltersRepository,
public sortingRepository: DocumentsSortingRepository,
private http: HttpClient,
) {
this.load();
}
private load(): void {
this.http
.get(`${this.url}/properties`)
.pipe(map((response: string) => JSON.parse(response)))
.subscribe((response: ResponseSettings) => {
this.filtersRepository.modifyDefault();
});
}
export class DocumentsFiltersRepository extends FiltersRepository {
constructor(private documentsReferencies: DocumentsReferencies) {
super();
this.reestrTypes.subscribe((collection: any[]) => {
this.setDefault([
new Filter({
title: 'По статусу',
type: FilterType.DocumentsStatus,
collection: documentsStatusList,
}),
new Filter({
title: 'Реестр',
type: FilterType.DocumentsReestr,
collection: collection,
}),
]);
});
}
public get reestrTypes(): Observable<any> {
return this.documentsReferencies.reestrtypes;
}
}
this.filtersRepository.modifyDefault();
, the dependency method would have already completed and returned the data:this.reestrTypes.subscribe((collection: any[]) => {}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question