Skip to content

Instantly share code, notes, and snippets.

@lanterndev
Last active January 3, 2016 16:49
Show Gist options
  • Save lanterndev/8491991 to your computer and use it in GitHub Desktop.
Save lanterndev/8491991 to your computer and use it in GitHub Desktop.
AngularJS Issue 4608 (with html5Mode = true)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular-route.min.js"></script>
<script>
angular.module('broken', [])
.config(function($locationProvider) {
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
})
.controller('MainCtrl', function ($scope, $location) { });
</script>
</head>
<body>
<div ng-app="broken">
<h1>AngularJS with anchor link - broken by injecting $location</h1>
<div ng-controller="MainCtrl">
<a href="#anchor">broken link to anchor</a>
<div style="margin-top: 800px">
<a name="anchor">anchor</a>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment