Hi, I’m trying to set sideMenu’s width via a $scope variable.
index.html’s body
<ion-side-menus>
<ion-side-menu-content>
<!-- content -->
</ion-side-menu-content>
<ion-side-menu side="left" width="{{width}}" expose-aside-when="(orientation: landscape) and (device-width:414px), (min-width:768px)">
<!-- side content -->
</ion-side-menu>
</ion-side-menus>
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.