angular.module('namespace').directive('ngWindowResize', function($window, $parse) { return function(scope, element, attr) { // jshint ignore:line angular.element($window).bind('resize', function(event) { $parse(attr.ngWindowResize)(scope, { $event: event, $element: element }); }); }; });