title: AngularJS back button
body: <p>I'm working on making an Android app using Phonegap and AngularJS. I'm attempting to create a button to be used as both a "cancel" and a "back" button, that will essentially just hit the browser's 'back' button.</p>
  
  <p>Here's some sample HTML for the cancel button:</p>
  
  <pre><code>&lt;a href="#" ng-click="goBack()" class="button--cancel weight--bold vertical-align--middle text-center"&gt;cancel&lt;/a&gt;
  </code></pre>
  
  <p>And here is the controller for that page, with the goBack() button:</p>
  
  <pre><code>function NewOccasionCtrl($scope, $window) {
      $scope.$window = $window;
      $scope.goBack = function() {
        $window.history.back();
      };
  }
  </code></pre>
  
  <p>This throws no errors, but also doesn't work... the emulator remains on the same page. Without the <code>$scope.$window = $window</code> it throws an error. I was hoping to achieve a functional 'back' button without having to create/use a directive, because as far as I understand those then implement templating and things I don't need/want.</p>
  
  <p>Is there a way to do this? Thanks</p>