0

i use the same drawer for left and for right depends on the language:

<div snap-drawer="{{$root.direction=='rtl'?'right':'left'}}">

the problem is when the direction is changed in real time the swipe drawer stays in the same place, i think it needs to be destroyed and reinitialized.

please advice how to continue.

Mike
  • 741
  • 13
  • 40

1 Answers1

0

I fixed it but it wasn't that trivial. in angular-snap.js at the snap-drawr directive i added:

attrs.$observe('snapDrawer', function (newVal, oldVal) {
            if (newVal !== oldVal) {
                if (attrs.snapDrawer === 'right') {
                    element.removeClass('snap-drawer-left');
                    element.addClass('snap-drawer-right');
                    scope.disable("left");
                } else {
                    element.removeClass('snap-drawer-right');
                    element.addClass('snap-drawer-left');
                    scope.disable("right");
                }
            }
        });

now it waits to see if the variable changes and if it does it changes the initial settings.

Mike
  • 741
  • 13
  • 40