Skip to content

Instantly share code, notes, and snippets.

@t-palmer
Last active March 28, 2018 14:29
Show Gist options
  • Save t-palmer/14c05c8b6e3dde76299e9881a3f14d76 to your computer and use it in GitHub Desktop.
Save t-palmer/14c05c8b6e3dde76299e9881a3f14d76 to your computer and use it in GitHub Desktop.
Tour of Heroes index.html updated to support deployment anywhere.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tour of Heroes</title>
<base href="/" id="baseHref">
<script>
(function() {
var mypath = window.location.pathname;
mypath = mypath.endsWith('/') ? mypath : mypath+'/';
var hispath = '/' + window.location.pathname.split('/')[1] + '/';
console.log('mypath',mypath);
console.log('hispath',hispath);
console.log('window.location.pathname',window.location.pathname);
document.getElementById('baseHref').href = mypath;
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment