AngularJS 2和webcomponents,仿真和polyfill

Vic*_*lio 4 javascript web-component angularjs shadow-dom angular

AngularJS 2能够使用Shadow DOM本机,当encapsulation: ViewEncapsulation.Native我按照我的理解设置时,它是Web组件的一部分......

但这给出了一些问题:

  • 什么时候encapsulation: ViewEncapsulation.Native它会回退到ViewEncapsulation.Emulated浏览器不支持Shadow DOM的时候?
  • 当浏览器不支持Shadow DOM并设置时,是否能够使用webcomponents polyfill encapsulation: ViewEncapsulation.Native

Gün*_*uer 6

没有后备ViewEncapsulation.NativeViewEncapsulation.Emulated当浏览器不支持本机的影子DOM.这将导致运行时错误.

如果要使用Native,可以加载webcomponents polyfill并启用shadow DOM,如Global Polymer设置中所示.