Created
March 4, 2017 09:07
-
-
Save mosfet1kg/fc01f4731c7f00a4a5669b333a524b6a to your computer and use it in GitHub Desktop.
angular window resize evet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In your controller | |
var w = angular.element($window); | |
$scope.$watch( | |
function () { | |
return $window.innerWidth; | |
}, | |
function (value) { | |
$scope.windowWidth = value; | |
}, | |
true | |
); | |
w.bind('resize', function(){ | |
$scope.$apply(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment