Created
August 25, 2018 18:37
-
-
Save jkasun/b98f24cc4272fdb6bd991089f7d8a971 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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