By defining a timeout you can set a time limit to wait for a web request. timeout, is the time limit that a web request can not pass. for example if I define a timeout of 3 seconds, the web request while requesting the data, is canceled if it exceeds 3 seconds. I would like my web service not to exceed 3 seconds. how can I do it? I am a newbie in the world of angular.js.
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs/Observable';
import { GLOBAL } from '../app.constantes';
@Injectable()
export class AppService{
public url: string;
constructor(
public _http: HttpClient
){}
getAll(url,method,param): Observable<any>{
let config={};
config["timeout"]=3000;
config["data"]=param ? param: {}; //in case of POST this is the "data" property, with GET is "params" I believe..
return this._http.post(url,config);
}
No, I do not know if I was not clear with my question. But I refer to the property "timeout" of web requests. no set timeout..