【发布时间】:2020-02-21 01:00:34
【问题描述】:
我正在将 XML 结果从第三方 API 检索到 ASP.net Web API。现在我想将此检索到的 XML(转换为 JSON)发送到角度打字稿文件。我怎样才能实现它?
我的方法 1. 将 JSON 从模型类发送到控制器,然后从控制器发送到角度服务或组件的 .ts 文件。 2.从模型类发布到组件的 .ts 文件。
var objJson = new JavaScriptSerializer().Serialize(responseB);
var response = await client.PostAsync("http://localhost:4200/add", new StringContent(objJson, Encoding.UTF8, "application/json"));
var responseString = await response.Content.ReadAsStringAsync();
【问题讨论】:
标签: asp.net angular typescript