Created
January 25, 2016 10:34
-
-
Save fend25/3619d6d730039c30a34d to your computer and use it in GitHub Desktop.
alight router draft
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>alight router</title> | |
</head> | |
<body> | |
<div al-router-screen="auth"> | |
<!-- common header --> | |
<div al-router-view="authSection"></div> | |
</div> | |
<div al-router-screen="main"> | |
<div al-router-view="header"></div> | |
<div al-router-view="mainSection"></div> | |
<div al-router-view="footer"></div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or 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
function loginCtrl($s) {} | |
function registerCtrl($s) {} | |
function headerCtrl($s) {} | |
function footerCtrl($s) {} | |
function feedCtrl($s) {} | |
function usersCtrl($s) {} | |
function postsCtrl($s) {} | |
const router = {screen: () => {}}; | |
router.screen({ | |
name: 'auth', | |
views: { | |
authSection: { | |
states: { | |
login: { | |
url: '/login', | |
controller: loginCtrl, | |
template: `<login></login>` | |
}, | |
register: { | |
url: '/register', | |
controller: registerCtrl, | |
template: `<register></register>` | |
}, | |
$defaultState: 'login' | |
} | |
} | |
} | |
}).screen({ | |
name: 'main', | |
views: { | |
header: { | |
controller: headerCtrl, | |
template: `<header></header>` | |
}, | |
footer: { | |
controller: footerCtrl(), | |
template: `<footer></footer>` | |
}, | |
mainSection: { | |
$defaultState: 'feed', | |
states: { | |
feed: { | |
url: '/feed', | |
controller: feedCtrl, | |
templateUrl: '/templates/feed.html' | |
}, | |
users: { | |
url: '/users/:userid', | |
controller: usersCtrl, | |
templateUrl: '/templates/users.html' | |
}, | |
posts: { | |
url: '/posts/:postid', | |
controller: postsCtrl, | |
templateUrl: '/templates/posts.html' | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment