 
         
      
    
        import {bootstrap, Component, View} from 'angular2/angular2';
      angular.module('app', ['Dependency'])
        @Component({
          selector: 'todo-app’
        })
        class TodoApp {}
      Directive with template + Controller
        @Component({ ... })
        @View({
          template: `<h1>{{title}}</h1>` // or:
          //templateUrl: 'todos.html'
        })
        class TodoApp { ... }
      Directive Template/TemplateUrl
        @Component({ selector: 'todo-app’ })
        @View({ template: `<h1>{{title}}</h1>` })
        class TodoApp {}
        bootstrap(TodoApp);
      
        <todo-app></todo-app>
      angular.module('app', ['Dependency'])
<body ng-app="todo-app">
        @Component({ selector: 'todo-app’ })
        class TodoApp {
          // initial values
          constructor() {
            this.todos = ['First thing', 'Second thing', 'Third thing'];
          }
        }
      Controller
        export class TodoStorage {
          // initial values
          constructor () {
            this.STORAGE_ID = 'todos-angular2';
          }
          // methods
          get() {
            return JSON.parse(localStorage.getItem(this.STORAGE_ID) || '[]');
          }
          put(todos) {
            localStorage.setItem(this.STORAGE_ID, JSON.stringify(todos));
          }
        }
      Singletons: Controller, Service, Factory, Directive
        <input #new-todo (keydown)>
      
        <input #new-todo (keydown)=“addTodo($event, newTodo.value)”>
      ng-keydown=($event, newTodo)
        <ul>
          <li [style.background-color]=“newTodo.value”>
            {{newTodo.value}}
          </li>
        </ul>
      ng-style="{'background-color':newTodo}">
        import {bootstrap, Component, View, For} from 'angular2/angular2';
        @View({
          templateUrl: 'todos.html’,
          directives: [For]
        })
        class TodoApp{
          constructor() {
            this.todos = [‘first thing’, ‘second thing’, ‘third thing’];
          }
        }
      
        <ul *for=“#todo of todos”>
          <li>
            <p>{{todo}}</p>
          </li>
        </ul>
      ng-repeat="todo in vm.todos"
      <ul *for=“#todo of todos; var i = index;”>
        <li>
          <p>{{i}}. {{todo}}</p>
        </li>
      </ul>
    ng-repeat="todo in vm.todos track by $index">
        import {bootstrap, Component, View, For, If} from 'angular2/angular2';
        @View({
          templateUrl: 'todos.html’,
          directives: [For, If]
        })
        Class TodoApp{}
      
        import {Control, FormDirectives, ControlDirective} from 'angular2/forms';
        @Component({ ... })
        @View({ ...
          directives: [For, If, FormDirectives]
        })
        class TodoApp {
          constructor( ...) {
          ...
            this.newTodo = new Control('');
          }
        }
      
        import {CustomValidators} from 'validators';
        @Component({
          injectables: [TodoStorage, CustomValidators]
        })
        class TodoApp{
          constructor(storage: TodoStorage, custom: CustomValidators) {
            this.newTodo = new Control('', custom.badLanguage);
          }
        }
      
        export class CustomValidators{
          // c: Control
          badLanguage(c) {
            // 18dogbaby = bad language in Korean
            if(c.value.match(/18dogbaby/)) {
              return {
                badLanguage: true
              };
            }
          // return null = valid
          return null;
          }
        }
      
        <form id="todo-form" [class.invalid]="!newTodo.valid">
      Valid, Pristine, Dirty
 llenges
        llenges
      
        self rating: ★★★☆☆
        link
        version
        data & @name
        comments
      @pkozlowski_os | Plunkers were based on these.
Built in Angular!
@marcolago | Fantastic HTML Presentation Framework
Code Syntax highlighting
