Hello, 
I hava  a directive that should react ($watch)  if I resize the window.
A directive react only on innerWidth but not on innerHeight.

I cant solve this problem. Can someone help me?


Here is my codesnippet:


*app.directive('resizeWatch', function ($window) {*
*    return function ($scope, element) {*
*        var w = angular.element($window);*
     
*        $scope.$watch(function () {*
*            return {*
*                width: element.innerWidth(),*
*                height: element.innerHeight()     *
*            };*
*        }, function (newValue, oldValue) {*
*            var vm = $scope.vm;*
*            vm.mainWidth = newValue.width;*

*          DO SOMETHING*

*        }, true);*

*                w.bind('resize', function () {*

*            $scope.$apply();*
*            });*

*    }*
*});*

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to