title: $timeout "Undefined is not a function"
body: <p>I am attempting to use timeout to offset the resize trigger by a couple of mili seconds so that it works when I maximise the window. Unfortunately I am getting undefined is not a function:</p>
  
  <pre><code>angular.element(window).resize(function() {
      var newBreakpoint = getBreakpoint();
      var previousBreakpoint = null;
  
      if (newBreakpoint != currentBreakpoint) {
          previousBreakpoint = currentBreakpoint;
          currentBreakpoint = newBreakpoint;
      }
  
      var currentWindowWidth = window.innerWidth;
  
      var broadcastResize = function() {
          $scope.$broadcast('windowResize', currentBreakpoint, previousBreakpoint, currentWindowWidth);
      }       
  
      $timeout(broadcastResize, 150);
  
  }); 
  </code></pre>
  
  <p>Within this directive:</p>
  
  <pre><code>adminLayoutDirectives.directive('viewFrame', [function($scope, $rootScope, $timeout) {
      return {
          controller: function($scope, $element) {
              var width = function() {
                  return $element.width();
              } 
  
              var getBreakpoint = function() {
                  var windowWidth = window.innerWidth;
  
                  if(windowWidth &lt; 768) {
                      return 'extra small';
                  } else if (windowWidth &gt;= 768 &amp;&amp; windowWidth &lt; 992) {
                      return 'small';
                  } else if (windowWidth &gt;= 992 &amp;&amp; windowWidth &lt; 1200) {
                      return 'medium';
                  } else if (windowWidth &gt;= 1200) {
                      return 'large';
                  }                   
              }
  
              currentBreakpoint = getBreakpoint();
  
              angular.element(window).resize(function() {
                  var newBreakpoint = getBreakpoint();
                  var previousBreakpoint = null;
  
                  if (newBreakpoint != currentBreakpoint) {
                      previousBreakpoint = currentBreakpoint;
                      currentBreakpoint = newBreakpoint;
                  }
  
                  var currentWindowWidth = window.innerWidth;
  
                  var broadcastResize = function() {
                      $scope.$broadcast('windowResize', currentBreakpoint, previousBreakpoint, currentWindowWidth);
                  }       
  
                  $timeout(broadcastResize, 150);
  
              }); 
          }
      }
  }]);
  </code></pre>