<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
<script src="https://jspm.io/system@0.18.17.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.36/angular2.min.js"></script>
<script>
System.config({
paths: {
'main.js': 'main.js'
}
});
System.import('main.js');
</script>
</head>
<body>
<app></app>
<br/>
<h2><a href="http://www.code-sample.com/2015/07/angularjs-2-documentation-with-example.html" target="_blank">For more examples in angular 2</a></h2>
</body>
</html>
/* Styles go here */
import {Component, View, bootstrap} from 'angular2/angular2';
@Component({
selector: 'app',
bindings: [Service]
})
@View({
template: '{{greeting}} I am Anil!'
})
class App {
constructor(service: Service) {
this.greeting = service.greeting();
setTimeout(() => this.greeting = 'Hi,', 2000);
}
}
class Service {
greeting() {
return 'Welcome you!';
}
}
bootstrap(App);