@abhayastudios wrote:
Hi there,
I was wondering what the best way would be to determine dynamically, based on LTR or RTL text direction, whether a side menu should be on the left or right. I am using angular translate and thought about doing something like this, where settings.text-align should result in either 'left' or 'right':
<ion-side-menu side="{{ 'settings.text-align' | translate }}"> [...] </ion-side-menu>
Coupled with a button like this:
<button ng-show="menu.showNavMenuButton()" ng-click="menu.toggleNavMenu()" class="button button-icon ion-navicon"> </button>
and then in JS:
menu.toggleNavMenu = function() { if ($filter('translate')('settings.text_direction')=='rtl') { $ionicSideMenuDelegate.toggleRight(); } else { $ionicSideMenuDelegate.toggleLeft(); } }
That does not seem to work. I guess you cannot resolve attributes values through angular-translate filters. If I change the value of the side attribute to a static "left" or "right" it will work fine for that side but not the other.
Currently I solved it by defining the ion-side-menu section twice, with exactly the same content except that the side attribute is set to "left" once and "right" once. It works because when clicking the button it will always open the relevant side, but obviously it is ugly and not DRY to do it like this.
Anyone know how to do this cleaner?
Thanks!
Posts: 1
Participants: 1