jeudi 23 juin 2016

AngularJS element.bind('resize') not updating $scope variable

I am trying to set a scope variable for the innerWidth of the browser window using the code below. It works when viewed in the console, but the function is not updating the $scope variable. Why?

angular.element($window).bind('resize', function () {
    console.log('resize', $window.innerWidth);  // I can see change here
    $scope.window_width = $window.innnerWidth;  // no change here
});

Aucun commentaire:

Enregistrer un commentaire