How to change the side menu direction dynamically?
At the opening tag of ion-menu in app.component.ts, Why didnât the following code run? <ion-menu [side]="(this.platform.dir() == rtl) ? right : left" [content]="content" type="overlay">
To understand your question. You want to change this sidemenu to appear on both sides so you get one menu on the left and one menu on the right with different buttons to click ?
I still donât fully understand your question. I think you mean that when u choose âarâ the menu should be on the right and swipe open to the left.
As I said before:
It is multilingual app. So, the side menu has two behaviors not one.
Assume I have a language selector that setDir of the document.
In case of choosing Arabic language, the side menu would swipe or overlays from right to left.
In case of choosing English language, the side menu would swipe or overlays from left to right.
Your code works in case for Arabic case only, if I change the language to English, it stills swipe from right to left.
Finally, I found solution by help from a friend. The solution is to create two side menus: one for RTL and the other for LTR. Choosing the menu based on *ngIf directive of the selected dir of the language. Here is the code.
<!--*****************************************-->
<!-- RTL Menu : Overlaying From Right To Left-->
<ion-menu *ngIf="this.platform.dir()==='rtl'"
side="right"
[content]="content">
<!-- Side menu header option -->
<ion-header no-border>
<ion-toolbar text-center padding-top>
<ion-title>MENU</ion-title>
</ion-toolbar>
</ion-header>
<!-- Side menu content option -->
<ion-content>
<ion-list no-lines>
<ion-item menuClose *ngFor="let p of pages" (click)="openPage(p)">
.....
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
<!--*****************************************-->
<!-- LTR Menu : Overlaying From Left To Right-->
<ion-menu *ngIf="this.platform.dir()==='ltr'"
side="left"
[content]="content">
<!-- Side menu header option -->
<ion-header no-border>
<ion-toolbar text-center padding-top>
<ion-title>MENU</ion-title>
</ion-toolbar>
</ion-header>
<!-- Side menu content option -->
<ion-content>
<ion-list no-lines>
<ion-item menuClose *ngFor="let p of pages" (click)="openPage(p)">
......
</ion-item>
</ion-list>
</ion-content>
</ion-menu>