简体   繁体   English

如何以角度显示xml文件中的xml数据

[英]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)));
  }

Hi I am using angular httpclient to make a http get request from a spring controller which returns a XML response.嗨,我正在使用 angular httpclient 从返回 XML 响应的 spring 控制器发出 http get 请求。

The problem, i have xml data in my typescript file and i display it as xml data by console.log() but i can't display it as xml data in xml file in angular, can i do this?问题是,我的打字稿文件中有 xml 数据,我通过 console.log() 将其显示为 xml 数据,但我无法以 angular 将其显示为 xml 文件中的 xml 数据,我可以这样做吗? it's my typescript code to catch my data.这是我的打字稿代码来捕捉我的数据。

你应该订阅 observable

...getEmployees().subscribe();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM