<!DOCTYPE html>
<html>
<head>
<title>UNDERSTAND ROUTING IN ANGULAR 2</title>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.45/angular2.dev.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.45/router.dev.js"></script>
<script src="config.js"></script>
<script>
System.import('app/app.ts');
</script>
</head>
<body>
<ROUTER_DIRECTIVES_EXAMPLE></ROUTER_DIRECTIVES_EXAMPLE>
</body>
</html>
System.config({
//The typescript used for compilation.
transpiler: 'typescript',
});
import {Component, bootstrap, provide} from 'angular2/angular2';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS,
LocationStrategy, HashLocationStrategy} from 'angular2/router';
// Home Component
@Component({
selector: 'home',
templateUrl: 'Home.html'
})
export class Home_Component {}
// About Me Component diective.
@Component({
selector: 'AboutMe',
templateUrl: 'AboutMe.html'
})
export class AboutMe_Component {}
// Contact Me Component diective.
@Component({
selector: 'ContactMe',
templateUrl:'ContactMe.html'
})
export class ContactMe_Component {}
// Root Component diective.
@Component({
selector: 'ROUTER_DIRECTIVES_EXAMPLE',
template: `<div><h3><a [router-link]="['/Home']">Home</a>
<a [router-link]="['/AboutMe']">About Me</a>
<a [router-link]="['/ContactMe']">Contact Me</a>
<h3/><hr/></div>
<router-outlet></router-outlet>
` directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{path: '/', component: Home_Component, as: 'Home'},
{path: '/AboutMe', component: AboutMe_Component, as: 'AboutMe' }
{path: '/ContactMe', component: ContactMe_Component, as: 'ContactMe' }
])
class Root_Component{}
bootstrap(Root_Component, [ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
<h2>About Me</h2>
<p>
My name is Anil Singh. I was basically born and brought up in Kushinagar UP India and my Education up to bachelors has been carried out from the same place.
<br/>
<br/>
I have done my MCA from UPTU in 2009 and I have been working on Microsoft Technologies from last 6+ years using ASP.Net, C#, MVC, WCF, SQL, jQuery, JavaScript etc. and also worked on MVVM frameworks with KnockoutJs and AngularJs, Kendo ui etc.
<br/>
<br/>
Coming to my hobbies that are, I love learning new technologies, blogging and participating the forum discussions etc.
My other Qualifications are MCP, MCTS [515,513] and HIPPA Certified etc.
</p>
<h2>Conatct Me</h2>
My Dear Readers,
<br/>
<br/>
If you want to say something to me, you can freely contact to me using the below contact-me form or you can email me as given below.
<br/>
<br/>
Ø anil.singh581@gmail.com <br/>
Ø codesample786@gmail.com
<br/>
<h2>Welcome to <a href="http://www.code-sample.com" target="_blank">www.code-sample.com </a></h2>