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 @@ -4,6 +4,7 @@
<head>
<meta charset="UTF-8">
<title>Angular 2 - Countries and Capitals</title>
<base href="/" /> <!-- for avoid hashing strategy-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
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
16 changes: 16 additions & 0 deletions src/body.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {Component} from 'angular2/core';
import {ROUTER_DIRECTIVES, RouterLink} from 'angular2/router';

@Component({
selector: 'body',
directives: [ROUTER_DIRECTIVES],
template: `
<p style="margin:100px;"><center>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</center>
</p>
<center><button [routerLink]="['/Country']">Button</button>
`,

})
export class Body {

}
26 changes: 23 additions & 3 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
import {bootstrap} from 'angular2/platform/browser';
import {Component} from 'angular2/core';
import{Header} from './header'
import{Body} from './body'
// import{Footer} from './footer'
import {ROUTER_PROVIDERS} from 'angular2/router'; //for Routing
import {RouteConfig, RouterOutlet} from 'angular2/router'; //routeConfig for define routes and router_directive for links
import {CountryComponent} from './country/country';


@Component({
selector: 'app',
template: `
<h1>Countries and Capitals</h1>
<header></header>
<router-outlet></router-outlet>
<footer></footer>
`,
directives:[Header,RouterOutlet]
})
export class App {}
@RouteConfig([{
path: '/home',
name: 'Home',
component: Body,
useAsDefault:true
},{
path: '/country',
name:'Country',
component: CountryComponent
}])
export class App {}

bootstrap(App,[ROUTER_PROVIDERS])

bootstrap(App)
.then(success => console.log('Kicking off Countries and Capitals'))
.catch(error => console.log(error));
6 changes: 6 additions & 0 deletions src/country/country.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ul>
<li>Pakistan</li>
<li>Korea</li>
<li>Japan</li>
<li>Google</li>
</ul>
10 changes: 10 additions & 0 deletions src/country/country.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from 'angular2/core';


@Component({
selector: 'Country',
templateUrl:'src/country/country.html'
})
export class CountryComponent {

}
14 changes: 14 additions & 0 deletions src/footer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// import {Component} from 'angular2/core';
// //routeConfig for define routes and router_directive for links

// @Component({
// selector: 'footer',
// directives: [ROUTER_DIRECTIVES],
// template: `
// // <center><button [routerLink]="['/Country']">Button</button>

// `,
// })
// export class Footer {

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


@Component({
selector: 'header',
template: `
<center><h1>Countries and Capitals</h1></center>
<hr>
`,
})
export class Header {

}