Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular TypeError:无法读取属性';拆分';空值(…;)_Angular_Cordova Plugins_Ionic2 - Fatal编程技术网

Angular TypeError:无法读取属性';拆分';空值(…;)

Angular TypeError:无法读取属性';拆分';空值(…;),angular,cordova-plugins,ionic2,Angular,Cordova Plugins,Ionic2,我收到TypeError:在ionic2 angular 2中使用cordova传输插件将图像上载到服务器时,无法读取null(…)错误的属性“split”。这是代码 用于保存图像路径的图像选择器代码: ImagePick() { let options = { destinationType : Camera.DestinationType.FILE_URI, sourceType : Camera.PictureSourceType.PHOT

我收到TypeError:在ionic2 angular 2中使用cordova传输插件将图像上载到服务器时,无法读取null(…)错误的属性“split”。这是代码

用于保存图像路径的图像选择器代码:

ImagePick() {
    let options = {
      destinationType   : Camera.DestinationType.FILE_URI,
      sourceType        : Camera.PictureSourceType.PHOTOLIBRARY,
    };
    Camera.getPicture(options).then((imageData) => {


      this.Image = imageData;

      console.log(this.Image);
    }, (err) => {

      // Handle error
    });
  } 
文件传输选项

 let options = {
          fileKey: "avatar",
          fileName: "image.jpg",
          mimeType: "image/jpeg",
          params: {
            food: this.navParams.get("food"),
            location_id: this.navParams.get("location"),
            address: this.navParams.get("address"),
            instructions: this.navParams.get("instructions"),
            phone: this.myForm.controls.phone.value,
              code: "b08d131e06",
            outlets_attributes: 'outlet'
          },
          headers: {headers: this.user_service.Get_Header()}
        };

        console.log(this.Image);
使用cordova传输插件上传带有其他表单元素的图像

  let fileTransfer = new Transfer();
      if(this.Image!=null && this.Image!=""){
          console.log(this.Image);
            fileTransfer.upload(this.Image, URL, options).
            then((data) => {
              console.log(data);
            }, (err) => {
              console.log(err);
            });
      }
我做错了什么。我需要帮助。。。
谢谢

您可以粘贴完整的错误日志吗?TypeError:无法读取null(…)的属性“split”,仅获取此错误检查导致日志中此错误的文件和行。这是由于在option->params->header:{headers:this.user_service.Get_header()}中添加了头而发生的你知道如何在参数中添加标题和其他表单元素。你能粘贴完整的错误日志吗?TypeError:无法读取null(…)的属性“split”,只是获取此错误检查导致日志中此错误的文件和行。这是由于在选项->参数->标题中添加标题造成的:{headers:this.user_service.Get_Header()}您知道如何在params中添加Header和其他表单元素吗。。