如何从后端http.get()而不是Angular中的JSON数据?

时间:2019-06-12 14:40:46

标签: json angular http get angular-fullstack

我正在尝试从后端在Angular前端中显示一个对象,但这不是JSON对象。 我想使用http.get()函数,但它仅适用于JSON或可分配为键入“ json”对象的对象。

在我的TS Angular模板中:

getEditeur() {
return this.http.get('http://localhost:8080/editeur', {responseType: 'text'}).toPromise()
}

在我的浏览器前端页面中:

<html>
<head>
<script> window.H5PIntegration = parent.H5PIntegration || {
"url": "/h5p",
"postUserStatistics": false,
"saveFreq": false,
"hubIsEnabled": true,
"l10n": {
"H5P": {
  "fullscreen": "Fullscreen",
  "disableFullscreen": "Disable fullscreen",
  "download": "Download",
  "copyrights": "Rights of use",
  "embed": "Embed",
  "size": "Size",
  "showAdvanced": "Show advanced",
  "hideAdvanced": "Hide advanced",
  "advancedHelp": "Include this script on your website if you want dynamic sizing of the embedded content:",
  "copyrightInformation": "Rights of use",
  "close": "Close",
  "title": "Title",
  "author": "Author",
  "year": "Year",
  ...
  ...

它显示后端对象的“文本”,而不显示预期对象(这是预期对象的图片,显示在我的后端页面上): Expected object on screen, displayed in my backend

谢谢!

0 个答案:

没有答案