F
F
foobarsik2019-10-31 16:36:03
Angular
foobarsik, 2019-10-31 16:36:03

How to display server errors?

upd: the problem was solved by updating angular.
How to pull http code and error body/message?

public login() {
    this.dataService.login(this.loginForm.value).subscribe((data: any[]) => {
      this.router.navigate(['/collection']);
    }, error => {
      console.log(error); // здесь нужно вывести текст ошибки
    });
  }

  // В dataService:
  public login(params) {
    return this.httpClient.post(this.REST_API_SERVER + 'login', params);
  }

Now console.log(error) throws a TypeError5dbaedc7315ee527598408.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Karapetyan, 2019-10-31
@architawr

error.response?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question