Like the subject says really- when the sidemenu opens, either by clicking the sidebar-open icon or by dragging, is it possible to trigger an expression somehow?
Yeah sure, we have isOpen
for that.
if ($ionicSideMenuDelegate.isOpen(true)){
//some code here
}
http://ionicframework.com/docs/api/service/$ionicSideMenuDelegate/
That doesn’t seem to trigger when the sidemenu is opened… http://codepen.io/squrler/pen/FvbHh
Any idea @mhartington?
Looking into this, apparently this isn’t as straight forward as the docs made it seem
Not sure why isOpen isn’t working, but this should get thing going.
$scope.$watch(function () {
return $ionicSideMenuDelegate.getOpenRatio();
},
function (ratio) {
if (ratio == 1){
alert("hey");
}
});
1 Like
Thanks @mhartington! Does the trick
would it be possible to switch the ‘navicon’ with ‘X’ using this method? - i’m a little lost.
any help would be appreciated.
Sure can
3 Likes
Thank you so much for this, works perfectly.