I have to call HTTP. get function synchronously so that it will wait until its response didn't come. it should not go to execute next line until below line executes. Where I am wrong please help me out
this.classCheck.checkD().then(present => present ? console.log("Present==true " + present) : console.log(" Present==false " + present));
async checkD() {
let present: boolean = true;
let status : number;
const res = await this.http.get(url,{ headers: header, observe:'response'}).toPromise().then( response => {
console.log(response.status);
status = response.status;
});
if(status >= 400) {
present = false;
}
return present;
}