1

I just refactoring my code from matMenu to cdkMenu and explore that xPosition='before' won't work anymore.

I also read the documentation but didn't find how can I position cdkMenu if you have any experience with this case please help me :)

Val Do
  • 2,695
  • 4
  • 20
  • 35

1 Answers1

1

you can use cdkMenuPosition on the element with cdkMenuTriggerFor directive

cdkMenuPosition takes an array of ConnectionPositionPairs, to achieve the before effect on the menu set the ConnectionPositionPair as below

<button [cdkMenuTriggerFor]="menu" class="example-standalone-trigger" [cdkMenuPosition]="positions">Click me!</button>
positions = [
  new ConnectionPositionPair(
    { originX: 'end', originY: 'bottom' },
    { overlayX: 'end', overlayY: 'top' }
  ),
];

you can look at this answer for more info in Global Position Strategy

https://material.angular.io/cdk/menu/api#CdkMenuTrigger

Mr. Stash
  • 2,940
  • 3
  • 10
  • 24