// Angular-Importe
import { NgModule, Component, Input, Output, EventEmitter, ChangeDetectionStrategy, OnInit, OnChanges, SimpleChange, DoCheck, KeyValueDiffers, ChangeDetectorRef, Injectable } from '@angular/core';
import { LocationStrategy, HashLocationStrategy} from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { Router } from '@angular/router';

// Andere Frameworks
import * as _ from 'underscore'; // underscore (LINQ)
import { Observable } from 'rxjs/Rx'; // Reactive Extensions

// Importe für eigene Klassen
import { Flug } from '../Modell/Flug' // GO
import { FlugService } from '../Services/FlugService' // Dienst
import { Flugdetail } from '../Flugdetail/Flugdetail'; // Komponente
import { Datengenerator } from '../Services/Datengenerator'; // für Event

@Component({
 selector: 'Flugliste',
 templateUrl: 'App/_Cheatsheet/Cheatsheet.html',
 changeDetection: ChangeDetectionStrategy.Default,
 providers: [FlugService] // Lokale Registrierung eines Dienstes für Dependency Injection
})

export class CheatSheet implements OnInit {
 differ: any;

 status: string;
 flug: Flug = new Flug();
 flugSet: Flug[] ;
 flugSet$: Observable<Flug[]>;

 constructor(private flugService: FlugService) { }

//   @Input() count: number = 0;
//   @Output() countChange: EventEmitter<number> = new EventEmitter<number>();

//  get FreiePlaetze()
//  {
// return this.flug.FreiePlaetze;
//  }

 ngOnInit() {

  this.flugService.getAll((x) => 
  { this.flugSet = x;
     this.flug = this.flugSet[2];
    // this.count = this.flugSet.length; 
    }
   );
  this.flugSet$ = Observable.of(this.flugSet);

  // this.flug = null;
 }

 buchen(f:Flug)
 {
 
 }

}