Created
August 20, 2015 12:29
-
-
Save daviddt/df73017caac47ef2933b to your computer and use it in GitHub Desktop.
This file contains 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
/// <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: 'app' | |
}) | |
@View({ | |
directives: [RouterLink, RouterOutlet], | |
template: ` | |
<header> | |
<nav> | |
<ul> | |
<li> | |
<a [router-link]="['/search']">Search</a> | |
</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 App { | |
title: string; | |
constructor() { | |
this.title = 'App title'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment