I'm kinda new to angular.
I want to have a listener for whenever width of document changes.
So first of all I decided to add a $watch like this:
$scope.$watch(function(){
    return $window.innetWidth;
}, function(n, o){
    console.log(n);
    console.log(o);
});
But it only works on page load and not on resize.
Then I decided to write a Directive like this:
app.directive('watchWidth', [function(){
        return {
            restrict: 'A',
            link: function(scope, element) {
                element.style.display = 'none';
                $scope.$watch(function () {
                    return element.innerWidth;
                }, function (n,o) {
                    console.log(n);
                    console.log(o);
                });
            }
        };
    }]);
And add directive to my ng-view:
<div watchWidth ng-view class="main-wrapper"></div>
But nothing work and no error in console and I don't know what should I do!
Any help please?
 
    