Вызовите сервисную функцию внутри обратного вызова загрузчика - PullRequest
0 голосов
/ 04 декабря 2018
voidfn = () => {
      bootbox.confirm("Are you sure you want to continue", function (result, apiService) {
          if (result == true) {

              let response = this.apiService.getVoid(systemId, orderId).subscribe(
                  success => {
                      this.spinner = false;
                      this.toastr.success("Success");
                  }, error => {
                      this.spinner = false;                

                  }
              );
          }
      });

  }

В этом коде я не смог получить доступ к методу getVoid(), поскольку apiservice недоступен при вызове bootbox.

Есть ли способ сделать это.Пожалуйста, предложите ..

1 Ответ

0 голосов
/ 04 декабря 2018

Привет, я решил вышеуказанную проблему с функцией стрелки

voidfn = () => {
      bootbox.confirm("Are you sure you want to continue", (result)=> {
          if (result == true) {

              let response = this.apiService.getVoid(systemId, orderId).subscribe(
                  success => {
                      this.spinner = false;
                      this.toastr.success("Success");
                  }, error => {
                      this.spinner = false;                

                  }
              );
          }
      });
...