<!DOCTYPE html>
<html>
<head>
  <title>Angular2 datepicker Example</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>  
  
  <script src="https://code.angularjs.org/tools/traceur-runtime.js"></script>
  <script src="https://code.angularjs.org/tools/system.js"></script>
  <script src="https://code.angularjs.org/tools/typescript.js"></script>
  
  <script src="config.js"></script>
  <script src="https://code.angularjs.org/2.0.0-alpha.37/angular2.dev.js"></script>
  <script>
    System.import('./app.ts');
  </script>

</head>

<body>
  <app>
    loading...
  </app>
</body>

</html>
/* Styles go here */

### Angular Starter Plunker - Typescript
System.config({
  //use typescript for compilation
  transpiler: 'typescript',
  //typescript compiler options
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  paths: {
    'npm:': 'https://unpkg.com/'
  },
  //map tells the System loader where to look for things
  map: {
    
    'app': './src',
    
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
    
    '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
    '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
    '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
    '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
    '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
    '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
    '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
    
    'rxjs': 'npm:rxjs',
    'typescript': 'npm:typescript@2.0.2/lib/typescript.js'
  },
  //packages defines our app package
  packages: {
    app: {
      main: './main.ts',
      defaultExtension: 'ts'
    },
    rxjs: {
      defaultExtension: 'js'
    }
  }
});
import {bootstrap, FORM_DIRECTIVES, Host, Component, Directive, View, Renderer, DefaultValueAccessor, NgControl, Self, ElementRef, OnInit } from 'angular2/angular2'

@Directive({
  selector: '[date-picker]'
})
export class DatePicker extends DefaultValueAccessor implements OnInit {
  private element: ElementRef;
  
  constructor(@Self() model: NgControl, element: ElementRef, renderer: Renderer) {
    super(model, renderer, element);
    this.element = element;
  }
  
  public writeValue(value: any): void {
      $(this.element.nativeElement).datepicker('setDate', value);
    }  
  
  public onInit(): void {
    $(this.element.nativeElement).datepicker();
  }
}

@Component({
  selector: 'app'
})

@View({
  template: `
    <div>
      <form>
      <h1> Angular 2 datepicker </h1>
        <input type="text" date-picker ng-control="value" [(ng-model)]="value" />
      </form>
      <h1> Today's Date : {{value | date: 'dd/MM/yyyy'}}</h1>
      <br/> <a href="http://www.code-sample.com/2015/07/angularjs-2-documentation-with-example.html" target="_blank">For detail about Angular2 Datepicker...</a>
    </div>
  `,
  directives: [FORM_DIRECTIVES, DatePicker]
})
export class App {
  public value: Date;
  
  constructor() { 
    this.value = new Date(); 
  }
}

bootstrap(App);