Answer the question
In order to leave comments, you need to log in
Angular sends api request infinite times?
Whoo, guys. What to do if a request to api is sent an infinite number of times? Send json via subscribe, using a button.
Button
<button class="btn btn-primary save-button" (click)="OnSumbit()">Save</button>
this.bookingService.createBookingOptions(this.formArr.controls[i].value).
subscribe(result => {
console.log(result);
localStorage.removeItem("placeForm");
this.navigationService.navigate(`Places`, false);
});
public createBookingOptions (data: any): Observable<any> {
return this.httpService.post<any>(`/booking_options/`, data);
}
Answer the question
In order to leave comments, you need to log in
set a breakpoint
and find out why.
Apparently there is an infinite loop, or something like that.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question