Skip to content

Instantly share code, notes, and snippets.

@jkasun
Created August 25, 2018 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkasun/b98f24cc4272fdb6bd991089f7d8a971 to your computer and use it in GitHub Desktop.
Save jkasun/b98f24cc4272fdb6bd991089f7d8a971 to your computer and use it in GitHub Desktop.
let route = () => {
let path = window.location.pathname.split('/');
render(path);
}
let render = (path) => {
let rootPath = path[1];
let template = templates[rootPath];
document.getElementsByTagName('app-root')[0].innerHTML = template;
}
let templates = {
page1: `
<h1> This is the page 01 </h1>
`,
page2: `
<h1> This is the page 02 </h1>
`
}
route();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment