简体   繁体   English

摆脱 chrome 开发工具 html 视图封装中的 _nghost 和 _ngcontent

[英]get rid of _nghost and _ngcontent in chrome dev tools html view encapsulation

I am currently working on a already existing angular project - upon expecting the html page via google dev tools I found some weird additions to the html - like _nghost... and _ngcontent...我目前正在研究一个已经存在的 Angular 项目——通过谷歌开发工具期待 html 页面,我发现 html 中添加了一些奇怪的东西——比如 _nghost... 和 _ngcontent...

在此处输入图像描述

How do I get rid of those props?我如何摆脱那些道具? Ive never seen them in other projects.我从未在其他项目中见过他们。

I already found out, that it may have something to do with ViewEncapsulation in Angular, therefore I changed my tsconfig.json file so it includes the following statement:我已经发现,它可能与 Angular 中的 ViewEncapsulation 有关,因此我更改了我的 tsconfig.json 文件,使其包含以下语句:

在此处输入图像描述

Sadly no changes ... Thanks in advance for your help!可悲的是没有变化......提前感谢您的帮助!

Add ViewEncapsulation.None, like that:添加 ViewEncapsulation.None,像这样:

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: [ './app.component.scss' ],
    encapsulation: ViewEncapsulation.None
})

But in that case you need to work with styles specificity by yourself.但在这种情况下,您需要自己处理样式特异性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM