在Bootbox回调中调用服务函数

时间:2018-12-04 06:14:33

标签: angular bootbox

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 :(得分:0)

嗨,我已经解决了上述箭头功能的问题

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;                

                  }
              );
          }
      });