2015-12-11 13:31:30 -08:00
|
|
|
import {Component, View} from 'angular2/core';
|
|
|
|
import {bootstrap} from 'angular2/platform/browser';
|
2015-10-10 22:11:13 -07:00
|
|
|
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from 'angular2/router';
|
2015-08-04 15:08:59 -07:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'my-app'
|
|
|
|
})
|
|
|
|
@View({
|
|
|
|
template: '<h1>Hello</h1>',
|
|
|
|
})
|
|
|
|
class FooCmp {
|
2015-08-27 13:19:24 -07:00
|
|
|
constructor(a: string, b: number) {}
|
2015-08-04 15:08:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'my-app'
|
|
|
|
})
|
|
|
|
@View({
|
|
|
|
template: '<h1>Hello {{ name }}</h1><router-outlet></router-outlet>',
|
2015-08-18 14:46:35 -07:00
|
|
|
directives: ROUTER_DIRECTIVES
|
2015-08-04 15:08:59 -07:00
|
|
|
})
|
|
|
|
@RouteConfig([
|
|
|
|
{path: '/home', component: FooCmp}
|
|
|
|
])
|
|
|
|
class MyAppComponent {
|
|
|
|
name: string;
|
|
|
|
|
|
|
|
constructor() { this.name = 'Alice'; }
|
|
|
|
}
|
|
|
|
|
2015-10-10 22:11:13 -07:00
|
|
|
bootstrap(MyAppComponent, ROUTER_PROVIDERS);
|