How can I make Angular HTTP Post wait for node js response : <p>i am new to Angular/Node JS, and I am doing a project for university where I am trying to implement authorization/authentication in my frontend and backend.</p>

<p>So I made the method Login in the Node JS and testing with postman the response is what I want. But when I send call the method login in the Angular it doesnt return anything.</p>

<p>Using debug I could observe that the angular doesnt await for the response of Node JS, how can I make it only continue when the response arrives?</p>

<p>Node JS Method</p>

<pre><code>exports.cliente_login = function (req, res){
    let cliente = transform.ToLogin(req);
    service.ClienteLogin(cliente, function (cliente, erro) {
        if (cliente) {
            res.json(cliente);
        } else {
        return res.send(erro);
        }
    })
</code></pre>

<p>Angular Service Method </p>

<pre><code>loginCliente(cliente): Observable&lt;Cliente&gt; {
    return this.http.post&lt;Cliente&gt;(this.myAppUrl + this.myApiUrl + 'login', JSON.stringify(cliente), this.httpOptions)
      .pipe(
        retry(1),
        catchError(this.errorHandler)
      );
  }
</code></pre>

<p>Angular Auth Method</p>

<pre><code>login(email: string, password: string) {
    let user: any;
    let userLogin = new UserToLogin();
    userLogin.email = email;
    userLogin.password = password;

    user =  this.clienteService.loginCliente(userLogin);
    if (user &amp;&amp; user.token) {
      // store user details and jwt token in local storage to keep user logged in between page refreshes
      localStorage.setItem('currentUser', JSON.stringify(user));
      this.currentUserSubject.next(user);
    }

    return user;
  }
</code></pre>

<p>Thank you for your help !</p>
