skip to Main Content

It seems while using the angular project I wanted to hide style .navmenu [_ngcontent-ng-c3021713184] whenever I run a project so the question is how to hide [_ngcontent-ng-c3021713184] This one so any one have a best answer for this?

2

Answers


  1. Chosen as BEST ANSWER

    the answer is ViewEncapsulation.Emulated

    Options for handling it:

    1. Direct Component Styling: You can write styles in the component's own CSS file without worrying about the _ngcontent-* attribute, as Angular automatically handles that for encapsulation.

    2. Global Styling (if needed): If you want to target this from a global stylesheet (though not generally recommended unless necessary), you can:

    3. Use ViewEncapsulation Options:

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


  2. encapsulation: ViewEncapsulation.None,

    should do that trick.

    For more, have a look at https://v17.angular.io/guide/view-encapsulation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search