Есть некая форма:
<form [formGroup]="testSettingsForm" (ngSubmit)="getTestInfo(testSettingsForm.value)">
<mat-form-field>
<mat-label>Система</mat-label>
<mat-select formControlName="system">
<mat-option *ngFor="let sys of systemInfo"
[value]="sys.id"
(onSelectionChange)="getSystemVersion(sys.id);"
(click)="getSystemVersion(sys.id);">
{{sys.description}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Версия</mat-label>
<mat-select formControlName="systemVersion">
<mat-option *ngFor="let version of systemVersion"
[value]="version.id"
(onSelectionChange)="getTestType(version.system_id, version.id)"
(click)="getTestType(version.system_id, version.id)">
{{version.description}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Вид теста</mat-label>
<mat-select formControlName="testType">
<mat-option *ngFor="let type of testType"
[value]="type.id" (onSelectionChange)="getTestNumber(type.system_id, type.version_id, type.id)"
(click)="getTestNumber(type.system_id, type.version_id, type.id)">
{{type.description}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Номер теста</mat-label>
<mat-select formControlName="testNumber">
<mat-option *ngFor="let nums of testNumber"
[value]="nums.test_number">
{{nums.test_number}}
</mat-option>
</mat-select>
</mat-form-field>
<button mat-raised-button color="primary" type="submit">Загрузить</button>
</form>
Есть несколько функций, который отправляют запросы на бэк при изменении и при клике на опции.
getSystemFullInfo() {
this.repSrvc.getSystemName()
.subscribe(
res => {
this.systemInfo = res;
this.testSettingsForm.controls.system.setValue(res[0].id);
this.repSrvc.getTestResult(this.testSettingsForm.value).subscribe(result => {
this.testFullInfo.next(result);
});
}
);
}
getSystemVersion(systemId): any {
this.repSrvc.getSystemVersion(systemId)
.subscribe(
res => {
this.systemVersion = res;
this.testSettingsForm.controls.systemVersion.setValue(res[0].id);
}
);
}
getTestType(systemId, versionId): any {
this.repSrvc.getTestType(systemId, versionId)
.subscribe(
res => {
this.testType = res;
this.testSettingsForm.controls.testType.setValue(res[0].id);
}
);
}
getTestNumber(systemId, versionId, testType): any {
this.repSrvc.getTestNumber(systemId, versionId, testType)
.subscribe(
res => {
this.testNumber = res;
this.testSettingsForm.controls.testNumber.setValue(res[0].test_number);
}
);
}
getTestInfo(formData): any {
console.log(this.testSettingsForm.value);
this.testInfo = formData;
}
constructor(
private repSrvc: ReportingService,
) { }
ngOnInit(): void {
this.getSystemFullInfo();
}
Почему при инициализации приложения отправляется вот такая портянка из http запросов?