javascript - 在 IE11 的子窗口中打开新组件不起作用
问题描述
我按照示例https://stackblitz.com/edit/angular-rbapx4?embed=1&file=src/app/app.component.ts
产生在(点击)事件之后执行的代码:
const componentFactory = this.resolver.resolveComponentFactory(ExampleComponent);
let componentRef = componentFactory.create(this.injector);
this.OpenWindow = window.open('','childwindow', 'width=400, height=400, left=150, top=200');
this.OpenWindow.document.body.innerHTML = "";
this.OpenWindow.document.body.appendChild(componentRef.location.nativeElement);
它在 Chrome 和 FF 中运行良好,但在 IE 中不起作用,它打开没有内容的子窗口,它只是空的,在“主控制台”中它会导致 HierarchyRequestError。我怎样才能让它在 IE 中工作?
我不能使用使用路由的解决方案,这就是我不断尝试修改上述代码的原因。我还尝试了带有 CdkPortal 的解决方案https://stackblitz.com/edit/angular-open-window,这似乎无法在 IE 中运行。
解决方案
推荐阅读
- android - 如何在 viewModel MVVM Kotlin 中调用 notifydatachanged?
- node.js - 将 Shell 脚本转换为 nodejs 之一
- node.js - 当我使用 [] 设置对象时,为什么对象在 Express 中不起作用
- jquery - Select2Multiple 小部件的初始值
- javascript - 尝试使用它下载大文件时,Node.js 应用程序崩溃
- node.js - 快速授权中间件;当角色不够时
- android - 谁能告诉我那行代码有什么问题
- c++ - 如何在 Visual Studio Code 中放置自定义输入以进行调试
- spring-security - Spring security 5 和 OAuth2 - Success Handler 未被调用,登录后进入无限循环
- javascript - 使用 $.ajax post 将数据发送到 node.js 服务器不起作用