Sunday, 24 November 2019

adding a class using ng-class to a mat-menu

I'm trying to add a custom class to a mat-menu in my app, the value is visible to the component which includes this piece of HTMl and it evaluates to true on a DOM element sibling, but it doesn't really seem to apply to it when I inspect the resulting HTML, also the mat-menu container is added as a direct child to the body HTML element although the containing component is encapsulated into multiple angular components.

my HTML is as follows

        <mat-menu class="more-menu" [ngClass]="{ dutch: languageFlag === 'nl' }" #cardOptions="matMenu" xPosition="before" [overlapTrigger]="false">
          <button mat-menu-item>
            Button 1
          </button>
          <button mat-menu-item>
            Button 2
          </button>
        </mat-menu>

I can find the 'dutch' class added to other elements but not to the mat-menu



from adding a class using ng-class to a mat-menu

No comments:

Post a Comment