title: Unable to access 'window' object in an angular expression without a controller
body: <p>I am trying to show a <code>&lt;p&gt;</code> only in the <code>HTTP</code> protocol.</p>
  
  <p>Here is what I have so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>angular
  .module('myApp',[])
  .controller('myCtrl', ['$scope', '$window', function($scope, $window){
  
    $scope.name = 'Superhero';
  
    console.log('$window.location.protocol = ' + $window.location.protocol); // just checking
  
  }]);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"&gt;&lt;/script&gt;
  
  &lt;div ng-app="myApp"&gt;
  
    &lt;p ng-if="window.location.protocol === 'http:'"&gt;This needs to be shown in HTTP only.&lt;/p&gt; &lt;!-- doesnt work with $window either --&gt;
  
    &lt;div ng-controller="myCtrl"&gt;
      Hello, {{name}}!
    &lt;/div&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This snippet doesnt work in both <code>HTTP</code> and <code>HTTPS</code>.</p>
  
  <p>I am pretty sure the problem is about accessing the <code>window</code> object.</p>
  
  <p>How do I fix this?</p>
  
  <hr>
  
  <p><strong>Edit:</strong> Note that the <code>&lt;p&gt;</code> does not have any controller.</p>