import {Component, Input} from 'angular2/core';
import Counter from './counter.component';

@Component({
	selector: 'app',
	template: `
    <div>
      <counter [(count)]="number1">Child Number 1:</counter>
	    <counter [count]="number2" (countChange)="number2=$event">Child Number 2:</counter>
	    <counter [count]="number3" (countChange)="onCountChanged($event)">Child Number 3:</counter>
      <hr>
      <p>Parent Number1: {{number1}}</p>
      <p>Parent Number2: {{number2}}</p>
      <p>Parent Number3: {{number3}}</p>
	  </div>
	`,
	directives: [Counter]
})
export class App {
  number1: number = 10;
  number2: number = 20;
  number3: number = 30;
  
  constructor() {}
  
  onCountChanged(value) {
    this.number3 = value;
  }

  
}

import {bootstrap}    from 'angular2/platform/browser'
import {App} from './app.component'

bootstrap(App);
<!DOCTYPE html>
<html>

  <head>
    <title>Angular 2 QuickStart</title>
    <!-- 1. Load libraries -->
    <script src="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"></script>
    <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-beta.0/Rx.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.0/angular2.dev.js"></script>
    <!-- 2. Configure SystemJS -->
    <script>
      System.config({
        transpiler: 'typescript', 
        typescriptOptions: { emitDecoratorMetadata: true }, 
        packages: {'app': {defaultExtension: 'ts'}} 
      });
      System.import('app/boot')
            .then(null, console.error.bind(console));
    </script>
  </head>

  <body>
    <app>Loading...</app>
  </body>

</html>
import {Component, Input, Output, EventEmitter} from 'angular2/core';

@Component({
  selector: 'counter',
  template: `
    <div>
     
      <p>
        <ng-content></ng-content>
        Count: {{ count }} - 
        <button (click)="increment()">+1</button>
      </p>
      
    </div>
  `
})
export default class Counter {
  @Input() count: number;
  @Output() countChange: EventEmitter<number> = new EventEmitter<number>();
  
  increment() {
    this.count++;
    this.countChange.emit(this.count);
  }
}