【发布时间】:2021-04-26 16:34:34
【问题描述】:
我想知道是否有一种方法可以在新页面或新组件中呈现 html 的 http 响应?具体问题如下所述。
调用后端的代码:
const headers = { 'content-type': 'application/x-www-form-urlencoded'}
let obs = this.http.post<any>("http://localhost:8080/project/Raffle", _data,{ headers, responseType: 'text' as 'json'});
obs.subscribe((response)=>console.log(response));
响应是显示在控制台中的 html 页面。
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Thank you for taking the survey! You win the raffle of two movie tickets!</title>
</head>
<body>
...
</body>
</html>
我的问题是如何将内容呈现在新组件中或可能呈现为新的 html 页面? 非常感谢!
【问题讨论】:
标签: html angular rendering httpresponse