mercredi 3 avril 2019

angular post method if condition not working

in angular 7 post method am getting an error value as true . but when i try to use that value in if condition, if condition is not working ,always else getting executed.

angular with node js (MEAN)

errorParametre: any ;
this.http.post(`${this.uri}/compare`, {obj , err})
        .subscribe(res => {
           this.errorParametre = res['res']['err'].error;
           console.log(this.errorParametre);
           if (this.errorParametre === true) {
            console.log('hello');
            } else {
             console.log('irritating');
            }
           });
          }

console.log(this.errorParametre) => true but also not able to go inside if condition .. only false getting executed always

Aucun commentaire:

Enregistrer un commentaire