Tar*_*yka 1 production web angular
我想知道是否有机会隐藏我的简单网站是用 Angular 制作的。我可以在网站上看到这一点<app-root _nghost-iie-c28="" ng-version="11.0.4"><router-outlet _ngcontent-iie-c28="">,并认为所有 Angular 网站都有这些标签,但没有。那么,我可以通过什么方式隐藏它们呢?
相关票务
只需添加根组件即可删除版本属性:
@Component({
selector: '[data-app]',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
constructor(private _elementRef: ElementRef) {
}
ngOnInit(): void {
this._elementRef.nativeElement.removeAttribute("ng-version");
}
}
Run Code Online (Sandbox Code Playgroud)
当涉及到该_nghost属性时,您似乎无法按照设置应用程序的方式摆脱它,因为指向填充内容的位置,但是您可以创建一个新组件并在那里添加路由,以便它在树中进一步显示(如果您不这样做)不希望它出现在你的根组件中。
注意:正如票证相关讨论中提到的,这可能主要用于生产构建,因为某些工具依赖于开发构建的属性。
| 归档时间: |
|
| 查看次数: |
1958 次 |
| 最近记录: |