title: How to stop rendering any html before authentication in angularjs
body: <p>I am working on an angularjs app, which allows users to login and write stories. Both login and write has separate urls i.e.</p>
  
  <pre><code>app/login 
  app/write 
  </code></pre>
  
  <p>every time user pastes any of these urls in the browser, it'll be redirected to the write or login page accordingly. My problem is when someone pastes <strong>app/login</strong> in the browser first the write.html is rendered, then a status request is sent to the backend to check if the user is logged in. I want this to happen such that no html is rendered until it is confirmed that the user is logged in and if not user is simply redirected to the login page. 
  Any idea on how i may achieve that?</p>
  
  <p>part of my app.js file looks like this </p>
  
  <pre><code> $routeProvider.when('/login', {templateUrl: 'partials/index/login-form.html', controller: 'LoginCtrl'});
   $routeProvider.when('/write', {templateUrl: 'partials/home/write.html'});
  </code></pre>