将iframe响应从后端渲染/绑定到Angular中的html组件

时间:2020-07-28 02:03:02

标签: javascript html angular iframe

我正在向后端订阅,这给了我iframe(html)形式的响应。我只需要在我的html组件上呈现它。我该怎么办?当我控制台记录响应(iframe html响应)。我认为这是一个错误。我想念什么?

app.component.ts

export class AppComponent implements OnInit {
  constructor(private hpcService: HPCService) { }

  title = 'rohit-pbcc';
  iFrame = '';

  ngOnInit() {
    this.hpcService.getHPCIFrame().subscribe(response => {
      this.iFrame = response;
      console.log(String(this.iFrame));
    });
  }
}

service.ts

export class HPCService {
    constructor(private http: HttpClient) { }

    getHPCIFrame(): Observable<any> {
        const url = 'https://xxxxxx/xxx/xxxx/xxxxxx/xxxx';
        const request = HPCInitREquest;
        console.log(request);
        return this.http
            .post(url, request)
            .pipe(map((response) => {
                return response;
            }));
    }
}

此语句是控制台记录错误: console.log(String(this.iFrame));

错误详细信息:大家都可以看到。 iframe回来了,但是iframe在我回来的错误之内。我需要了解这里发生的事情。 enter image description here

0 个答案:

没有答案