angularproduction

Hide that website has been made with Angular


I was wondering if I could have an opportunity to hide that my simple website was made with Angular. I could see this <app-root _nghost-iie-c28="" ng-version="11.0.4"><router-outlet _ngcontent-iie-c28=""> on the website and thought that all Angular Websites got these tags, but no. So, which way can I hide them?


Solution

  • Related ticket

    Simply add in your root component for removing version attribute:

    @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");
        }
    }
    

    When it comes to the _nghostattribute it seems you wont get away with it the way you setup your app since point to where to populate content, however you could create a new component and add routing there so it shows further down the tree if you don't want it in your root component.

    Note: As mentioned in the ticket related discussions, this might be mostly for production build as some tools are dependent on the attribute for dev builds.