javascript - AngularJS 2 和网络组件、模拟和 polyfill

标签 javascript angularjs angular web-component shadow-dom

据我所知,AngularJS 2 在设置 encapsulation: ViewEncapsulation.Native 时可以使用作为 Web 组件一部分的 Shadow DOM native...

但这给出了一些问题:

  • encapsulation: ViewEncapsulation.Native 当浏览器不支持 Shadow DOM 时,它会回退到 ViewEncapsulation.Emulated 吗?
  • 当浏览器不支持 Shadow DOM 且设置为 encapsulation: ViewEncapsulation.Native 时,是否可以使用 webcomponents polyfill?

最佳答案

当浏览器不支持 native 影子 DOM 时,从 ViewEncapsulation.NativeViewEncapsulation.Emulated 没有回退。这将导致运行时错误。

如果你想使用Native,你可以加载webcomponents polyfills并启用影子 DOM,如 Global Polymer settings 中所示.

关于javascript - AngularJS 2 和网络组件、模拟和 polyfill,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38413523/

相关文章:

angularjs - Observable.interval() + flatMap() 奇怪的行为

javascript - 如何使用 Angular Material 在具有可扩展行的表中创建嵌套垫表

javascript - 选择使用 Angular 2 显示所选值的对象

javascript - Jquery UI 和 Bootstrap 问题

javascript - 如何将获取到的记录一条一条的显示出来

javascript - 如何使用 AngularUI Bootstrap Modal 获取 AngularJS 中 $Scope 的字段

angular - E2E Angular 6 websocket 模拟

javascript - 将代码从 canvas 转换为 svg

javascript - 如何在 JavaScript 中根据 "before"和 "after"条件对数组进行排序?

javascript - HTML 图像有条件下载