Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">

<head>
<base href="/">
<meta charset="UTF-8">
<title>Angular 2 - Countries and Capitals</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -15,6 +16,7 @@
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>

<!-- 2. Configure SystemJS -->
<script>
Expand Down
14 changes: 14 additions & 0 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

<div class="container">
<div class="jumbotron">
<header></header>
<p>This is a template showcasing the optional theme stylesheet included in Bootstrap. Use it as a starting point to create something more unique by building on or modifying it.</p>
</div>

<hr />
<footer></footer>

<router-outlet></router-outlet>

</div>
26 changes: 22 additions & 4 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import {bootstrap} from 'angular2/platform/browser';
import {Component} from 'angular2/core';
import {ROUTER_PROVIDERS} from 'angular2/router'; //for Routing

import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';

import {Header} from './header';
import {SideBar} from './sidebar';
import {Countries} from './countries';
import {Footer} from './footer';


@Component({
selector: 'app',
template: `
<h1>Countries and Capitals</h1>
`,
templateUrl: './src/app.html',

directives: [Header, SideBar, Countries, Footer, ROUTER_DIRECTIVES],
providers: [ROUTER_PROVIDERS]
})

// ################################################
// Router code commented out till the next session

@RouteConfig([
{path: '/countries', name: 'Countries', component: Countries}
// {path: '/home', name: 'Home', component: Body, useAsDefault: true},
])

export class App {}

bootstrap(App)
bootstrap(App) // , [ROUTER_PROVIDERS]
.then(success => console.log('Kicking off Countries and Capitals'))
.catch(error => console.log(error));
8 changes: 8 additions & 0 deletions src/countries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from 'angular2/core';

@Component({
selector: "countries_list",
template: 'Here goes the list'
})

export class Countries {}
1 change: 1 addition & 0 deletions src/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<footer></footer>
13 changes: 13 additions & 0 deletions src/footer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {Component} from 'angular2/core';
import {RouterLink} from 'angular2/router';

@Component({
selector: 'footer',
template: `
<a class="btn btn-success" [routerLink]="['/Countries']">Heroes</a>
`,
directives: [RouterLink]
})


export class Footer {}
8 changes: 8 additions & 0 deletions src/header.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from 'angular2/core';

@Component({
selector: 'header',
template: '<h1>Countries and Capitals</h1>',
})

export class Header {}
8 changes: 8 additions & 0 deletions src/sidebar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Component} from 'angular2/core';

@Component({
selector: 'side-bar',
template: 'My cool navigation'
})

export class SideBar {}