Created
August 20, 2015 09:48
-
-
Save daviddt/41a9872062460a2d8ebc 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: '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