Nested pages/dashboard route.

This commit is contained in:
smartapant 2016-04-21 20:34:07 +03:00
parent 62836727ae
commit 65b9d7e537
11 changed files with 296 additions and 66 deletions

View file

@ -5,6 +5,7 @@ import {Component, ViewEncapsulation} from 'angular2/core';
import {RouteConfig, Router} from 'angular2/router';
import {Home} from './home';
import {Pages} from './pages';
import {AppState} from './app.service';
import {RouterActive} from './router-active';
@ -21,76 +22,24 @@ import {RouterActive} from './router-active';
styles: [ require('normalize.css'), require('./app.scss') ],
template: `
<header>
<md-toolbar color="primary">
<span>{{ name }}</span>
<nav>
<ul>
<li router-active>
<a [routerLink]=" ['Index'] ">Index</a>
</li>
|
<li router-active>
<a [routerLink]=" ['Home'] ">Home</a>
</li>
|
<li router-active>
<a [routerLink]=" ['About'] ">About</a>
</li>
</ul>
</nav>
</md-toolbar>
</header>
<main>
<router-outlet></router-outlet>
</main>
<table class="table table-inverse">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
<pre>this.appState.state = {{ appState.state | json }}</pre>
<footer>
WebPack Angular 2 Starter by <a [href]="url">@AngularClass</a>
<div>
<img [src]="angularclassLogo" width="10%">
</div>
</footer>
`
})
@RouteConfig([
{ path: '/', name: 'Index', component: Home, useAsDefault: true },
{ path: '/home', name: 'Home', component: Home },
// Async load a component using Webpack's require with es6-promise-loader and webpack `require`
{ path: '/about', name: 'About', loader: () => require('es6-promise!./about')('About') }
{
path: '/pages/...',
name: 'Pages',
component: Pages,
useAsDefault: true
},
])
export class App {
angularclassLogo = 'assets/img/angularclass-avatar.png';