Angular ViewEncapsulation.ShadowDom不工作
我正在使用Angular 7和bootstrap 3.3.7(为了使用glyphicon)。我正在尝试在我的组件中使用viewEn封装.ShadowDom。但我得到一个错误“error-DOMException:未能对'Element'执行'attachShadow':此元素不支持attachShadow”。有人能解释我为什么会犯这个错误吗 我的ts代码和html代码分别是Angular ViewEncapsulation.ShadowDom不工作,angular,shadow-dom,Angular,Shadow Dom,我正在使用Angular 7和bootstrap 3.3.7(为了使用glyphicon)。我正在尝试在我的组件中使用viewEn封装.ShadowDom。但我得到一个错误“error-DOMException:未能对'Element'执行'attachShadow':此元素不支持attachShadow”。有人能解释我为什么会犯这个错误吗 我的ts代码和html代码分别是 @Component({ selector: 'favourite', templateUrl: './favo
@Component({
selector: 'favourite',
templateUrl: './favourite.component.html',
styleUrls: ['./favourite.component.css'],
encapsulation: ViewEncapsulation.ShadowDom
})
<span class="glyphicon"
[class.glyphicon-star]="isSelected"
[class.glyphicon-star-empty]="!isSelected"
(click)="glyphiconClicked()"></span>
@组件({
选择器:“收藏夹”,
templateUrl:“./favorite.component.html”,
样式URL:['./favorite.component.css'],
封装:viewEn封装.ShadowDom
})
因为ShadowDom是viewenclosuration枚举中的新元素,所以我只想看看结果。但是由于这个错误,我没有看到任何结果。封装:ViewEncapsulation.ShadowDom 在应用程序的根组件中写上这一行,即您在应用程序模块的“bootstrap:[]”数组或“entryComponents:[]”数组中提到的内容。不要使用它,因为影子dom在FF、IE和CHROME中的行为不同。