title: Window resize directive
body: <p>I was trying to make a div resize when the window resizes, after looking around, it seems that using a directive was the best solution.</p>
  
  <p>Template:</p>
  
  <pre><code>&lt;div elHeightResize ng-view ng-style="{ height: windowHeight }"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Directive:</p>
  
  <pre><code>myApp.directive('elheightresize', ['$window', function($window) {
      return {
          link: function(scope, elem, attrs) {
              scope.onResize = function() {
                  var header = document.getElementsByTagName('header')[0];
                  elem.windowHeight = $window.innerHeight - header.clientHeight;
              }
              scope.onResize();
  
              angular.element($window).bind('resize', function() {
                  scope.onResize();
              })
          }
      }
  }])
  </code></pre>
  
  <p>While I can log <code>elem.windowHeight</code> in <code>scope.onResize</code>, it doesn't seem to apply it to <code>ngStyle</code></p>
  
  <p>Am I still overlooking something?</p>
  
  <p>EDIT:</p>
  
  <p><code>&lt;div ng-view resize style="height: {{ windowHeight }}px"&gt;</code></p>
  
  <p>This solution seems to work, still interested into why using <code>ngStyle</code> wasn't working.</p>