[英]How to display xml data in xml file in angular
getEmployees() {
return
this.http.get('/assets/employees.xml', { responseType: 'text' })
.pipe(switchMap(async xml => console.log(xml)));
}
嗨,我正在使用 angular httpclient 从返回 XML 响应的 spring 控制器发出 http get 请求。
问题是,我的打字稿文件中有 xml 数据,我通过 console.log() 将其显示为 xml 数据,但我无法以 angular 将其显示为 xml 文件中的 xml 数据,我可以这样做吗? 这是我的打字稿代码来捕捉我的数据。
你应该订阅 observable
...getEmployees().subscribe();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.