Angular: Empty Fiddle

http://angularjs.org/

HTML

<script src="https://code.angularjs.org/1.2.9/angular.js"></script>
<div ng-controller="MyCtrl">
    <a href='#foo'>Link text</a>
  <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
      <a id="foo"></a>
  <h1>Headline</h1>
    <div ng-include="'test-include.html'"></div>
</div>
<script type="text/ng-template" id="test-include.html">
  <p>This text is in a separate partial and inlcuded via ng-include.</p>
</script>

JavaScript

var myApp = angular.module('myApp',[]);

function MyCtrl($scope, $location, $anchorScroll) {
   
}

myApp.directive('a', function() {
    return {
        restrict: 'E', 
        link: function(scope, element) {
            element.attr('href', '#' + element.attr('href'));
        }
    };
});