如何在Angular 8的Cordova函数中调用另一个函数?

嗨,当我尝试使用this.upload();从Cordova函数调用上载函数时出现此错误

如何在Angular 8的Cordova函数中调用另一个函数?

代码是

/* This is the cordova function to access the phone camera */
cameraTakePicture() {
  navigator.camera.getPicture(this.onSuccess,this.onFail,{
  quality: 50,destinationType: navigator.camera.DestinationType.DATA_URL,});
}
onSuccess(imageData) {
  const image: any = document.getElementById('myImage');
  image.src = 'data:image/jpeg;base64,' + imageData;
  this.selected = imageData;
  }
 onFail(message) {
    alert('Failed because: ' + message);
}
/* Upload function I am trying to call */
  Upload() {
    const file = new FormData();
    if (this.selected != null) {
    this.loading = true;
    if (this.mobile === true) {
      document.querySelector('#output').scrollIntoView({ behavior: 'smooth',block: 'center' });
      }
    file.append('file',this.selected,this.selected.name);
    this.env.upload(file).subscribe(
      data => {
        this.data = data;
        this.loading = false;
      },error => {
        this.loading = false;
      }
    );
    } else {
      this.notifiy.showInfo('You need to choose a file first','Info');
    }
  }

我不确定如何调用此函数的任何建议也将非常有帮助,如果有人可以解释为什么我会收到此错误,那将是非常好的

kaiyum88 回答:如何在Angular 8的Cordova函数中调用另一个函数?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3158877.html

大家都在问