Skip to content

Commit 327f67d

Browse files
feat(all): add option for app-with-router
* feat: add option for app-with-router * fix: review comments addressed * fix: review comments addressed (intendation) * fix: added the missing new line at end of file
1 parent 1d9da52 commit 327f67d

File tree

13 files changed

+84
-4
lines changed

13 files changed

+84
-4
lines changed

app-with-router/src/about.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>This is the page about the app.</h1>

app-with-router/src/missing.ext

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export class Missing {
2+
/* @if typescript */public /* @endif */static parameters = ['id'];
3+
/* @if typescript */public /* @endif */missingComponent/* @if typescript */: string /* @endif */;
4+
5+
/* @if typescript */public /* @endif */enter(parameters) {
6+
this.missingComponent = parameters.id;
7+
}
8+
}

app-with-router/src/missing.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h3>Ouch! Couldn't find '${missingComponent}'!</h3>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
nav {
2+
background: #eee;
3+
display: flex;
4+
}
5+
6+
a {
7+
padding: 10px;
8+
text-decoration: none;
9+
color: black;
10+
}
11+
a:hover {
12+
background-color: darkgray;
13+
}
14+
15+
.goto-active {
16+
background-color: lightgray;
17+
}

app-with-router/src/my-app.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<import from="./welcome"></import>
2+
<import from="./about.html"></import>
3+
4+
5+
<nav>
6+
<a goto="welcome">Welcome</a>
7+
<a goto="about">About</a>
8+
</nav>
9+
10+
<au-viewport default="welcome" fallback="missing"></au-viewport>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
nav {
2+
background: #eee;
3+
display: flex;
4+
}
5+
6+
a {
7+
padding: 10px;
8+
text-decoration: none;
9+
color: black;
10+
11+
&:hover {
12+
background-color: darkgray;
13+
}
14+
}
15+
16+
.goto-active {
17+
background-color: lightgray;
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
nav {
2+
background: #eee;
3+
display: flex;
4+
}
5+
6+
a {
7+
padding: 10px;
8+
text-decoration: none;
9+
color: black;
10+
11+
&:hover {
12+
background-color: darkgray;
13+
}
14+
15+
}
16+
17+
.goto-active {
18+
background-color: lightgray;
19+
}

app-with-router/src/welcome.ext

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export class Welcome {
2+
/* @if typescript */public /* @endif */message = 'Welcome to the Aurelia 2 app with routing!';
3+
}

app-with-router/src/welcome.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>${message}</h1>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Promise polyfill for old browsers
33
import 'promise-polyfill/lib/polyfill';
44
// @endif
5-
import Aurelia/* @if shadow-dom *//*, { StyleConfiguration }*//* @endif */ from 'aurelia';
5+
import Aurelia/* @if shadow-dom || app-with-router */, { /* @endif *//* @if app-with-router */RouterConfiguration/* @endif *//* @if shadow-dom *//*, StyleConfiguration*//* @endif *//* @if shadow-dom || app-with-router */ }/* @endif */ from 'aurelia';
66
import { MyApp } from './my-app';
77
// @if shadow-dom
88
// @if webpack
@@ -22,5 +22,8 @@ Aurelia
2222
}))
2323
*/
2424
// @endif
25+
// @if app-with-router
26+
.register(RouterConfiguration)
27+
// @endif
2528
.app(MyApp)
2629
.start();

0 commit comments

Comments
 (0)