How to update sideMenu width?


Hi, I’m trying to set sideMenu’s width via a $scope variable.

index.html’s body

    <!-- content -->
  <ion-side-menu side="left" width="{{width}}" expose-aside-when="(orientation: landscape) and (device-width:414px), (min-width:768px)">
    <!-- side content -->

app.js’s controller

app.controller('controller', function ($scope, $window) {
  $scope.width = $window.innerWidth*0.4;

It works but now I would update the value on window resizing.
Here’s a codepen:

I’m not familiar with $scope.$watch(), $scope.$apply() and ionic.on().
Any help? Thanks in advance.


Did you manage to do this? I tried

       return $window.innerWidth;
    }, function(value) {
       console.log("inner", value);
       $scope.notificationWidth = value * 0.8;

but it doesn’t work. (Either the watch function isn’t even called or if it is the width of side-menu isn’t changed)