Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 2bb06ef

Browse files
committed
examples(1.x/sibbling-routes): add simple sibbling viewport example
1 parent b647aa0 commit 2bb06ef

5 files changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
.container {
3+
display: flex;
4+
flex-flow: row;
5+
}
6+
7+
[ng-viewport] {
8+
flex: 1;
9+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
angular.module('myApp', [
2+
'ngNewRouter'
3+
])
4+
.controller('AppController', ['$router', AppController]);
5+
6+
function AppController($router) {
7+
$router.config([
8+
{ path: '/', redirectTo: '/users/posts' },
9+
{ path: '/users/posts', components: { left: 'users', right: 'posts' } },
10+
{ path: '/posts/users', components: { left: 'posts', right: 'users' } },
11+
]);
12+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<h1>Posts</h1>
3+
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<h1>Users</h1>
3+
</div>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<base href="/examples/angular-1/sibbling-routes/">
6+
<link rel="stylesheet" href="./app.css">
7+
</head>
8+
<body ng-app="myApp" ng-strict-di ng-controller="AppController">
9+
10+
<nav>
11+
<a href="./users/posts">users then posts</a>
12+
<a href="./posts/users">posts then users</a>
13+
</nav>
14+
<div class="container">
15+
<div ng-viewport="left"></div>
16+
<div ng-viewport="right"></div>
17+
</div>
18+
19+
<script src="/node_modules/angular/angular.js"></script>
20+
<script src="/dist/router.es5.js"></script>
21+
<script src="./app.js"></script>
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)