SHOW:
|
|
- or go back to the newest paste.
1 | - | ------------------------- |
1 | + | |
2 | - | Original working directive |
2 | + | .directive('resize', function($window) { |
3 | - | -------------------------- |
3 | + | |
4 | return function(scope, elem) { | |
5 | - | .directive('resize', function ($window) { |
5 | + | function applyHeight() { |
6 | - | return { |
6 | + | winHeight = $window.innerHeight; |
7 | - | restrict: 'A', |
7 | + | |
8 | } | |
9 | - | link: function (scope, elem, attrs) { |
9 | + | angular.element($window).bind('resize', function() { |
10 | scope.$apply(function() { | |
11 | - | var winHeight = $window.innerHeight; |
11 | + | applyHeight(); |
12 | }); | |
13 | }); | |
14 | applyHeight(); | |
15 | }; | |
16 | - | }); |
16 | + |