Skip to content

Instantly share code, notes, and snippets.

@daviddt
Created August 20, 2015 09:48
Show Gist options
  • Save daviddt/41a9872062460a2d8ebc to your computer and use it in GitHub Desktop.
Save daviddt/41a9872062460a2d8ebc to your computer and use it in GitHub Desktop.
///<reference path="../../typings/_custom.d.ts" />
import { Component, View } from 'angular2/angular2';
import { RouteConfig, RouterLink, RouterOutlet } from 'angular2/router';
import { Search } from '../components/search/search';
import { Artist } from '../components/artist/artist';
@Component({
selector: 'my-app'
})
@View({
directives: [RouterOutlet, RouterLink],
template: `
<header>
<nav>
<ul>
<li [router-link]=['/search']></li>
</ul>
</nav>
</header>
<main>
<h1>{{title}}</h1>
<router-outlet></router-outlet>
</main>
`
})
@RouteConfig([
{ path: '/', redirectTo: '/search' }
{ path: '/search', as: 'search', component: Search },
{ path: '/artist/:id', as: 'artist', component: Artist }
])
export class MyApp {
title: string;
constructor() {
this.title = 'My app title';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment