title: Getting page title from URL in Angular.js
body: <p>I was hoping this would be an easy one, but it seems to break my code!</p>
  
  <p>I am trying to make an <code>&lt;h1&gt;</code> out of the URL, with this:</p>
  
  <pre><code>$scope.pageTitle = $scope.$watch(function() {
      $scope.pageTitle = $location.url().substring(1);
    };
  </code></pre>
  
  <p>Then in my view, use this:</p>
  
  <pre><code>&lt;h1&gt;{{pageTitle}}&lt;/h1&gt;
  </code></pre>
  
  <p>Why doesn't this work?!</p>
  
  <p>Thanks to anyone who can help me get my head round this!</p>
  
  <p>JP</p>