我在Ionic 2中使用Angular2 Soap时遇到问题,我在我的Ionic 2空白项目中安装了Angular2 Soap,如下所示
sudo npm install autopulous-angular2-soap
然后在我的主页.ts{起始页}中,我放置了以下
import {SoapService} from "autopulous-angular2-soap/src/soap.service";
同样在我的app.module.ts中,我放置了以下
import {SoapService} from "autopulous-angular2-soap/src/soap.service";
当我运行ionic serve
时,我得到以下错误
[09:55:34] typescript: node_modules/autopulous-angular2-soap/src/soap.service.ts,
line: 1
Cannot find name 'xdom2jso'.
L1: import convert = xdom2jso.convert;
[09:55:34] typescript: node_modules/autopulous-angular2-soap/src/soap.service.ts,
line: 1
Cannot find namespace 'xdom2jso'.
L1: import convert = xdom2jso.convert;
[09:55:34] transpile failed
在node_modules文件夹中,我看到名为autopulous-anguular2-soap、autopulous-xdom2jso的文件夹
如何解决Cannot find namespace 'xdom2jso'
任何帮助都将不胜感激。非常感谢。
尝试插入
<script src="../node_modules/autopulous-angular2-soap/vendor/autopulous-xdom/xdom.js"></script>
<script src="../node_modules/autopulous-angular2-soap/vendor/autopulous-xdom2jso/xdom2jso.js"></script>
在src/index.html或src/app/app.html 中
老问题,我还没能让SOAP与Ionic一起工作,但我已经克服了这一点。
更改:
import convert = xdom2jso.convert;
收件人:
import xml2js from 'xml2js';
更改:
var response:{} = convert(responseNodeList[0], this.localName);
至:
var response:{} = xml2js.convert(responseNodeList[0], this.localName);