how can i update my variables values on ts function, i have to make click 2 times on the botton that execute the function logreg() to make it work, the first time i make click the comparison "if(this.pass_comp == this.pass ){" is always false no matters that i have already change the the variable pass. y try using ngzone but it didnt work or maybe i use it wrong. some help please
export class LoginComponent implements OnInit {
  pass_comp: string = "";
  pass: string = "";
  user: string = "";
  .
  .
  .
  constructor(private elementRef: ElementRef, private route: Router, private share: LogcontrlService, private api: BackeService) {
    this.elementRef.nativeElement.ownerDocument
      .body.style.backgroundImage = 'url(/assets/imgs/wall.jpg)';
    this.elementRef.nativeElement.ownerDocument
      .body.style.overflow = 'hidden';
  }
  ngOnInit(): void {}
  logreg() {
    if (this.user != "" && this.pass != "") {
      this.api.get_user(this.user).subscribe(x => {
        console.log(x.mensaje);
        if (x.mensaje == "consultado") {
          console.log(x.datos[0]);
          this.pass_comp = x.datos[0].pass;
          this.num = 1;
        }
      });
      console.log(this.pass_comp == this.pass);
      if (this.pass_comp == this.pass) {
        .
        .
        .
      }
    }
  }
 
    