import { Component, NgZone } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Store } from '@ngrx/store';
import { INCREMENT, DECREMENT, RESET } from './services/counter';
import { Observable } from 'rxjs/Observable';
import { Router } from '@angular/router';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
import { AuthProviders, AuthMethods } from 'angularfire2';
selector: 'app-component',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
export class AppComponent {
counter: Observable<number>;
private store: Store<AppState>,
this.ticketFirebase = af.database.list('/ticket');
'id': 1, 'texto': 'no me funciona nada', 'estado': 'enojado'
provider: AuthProviders.Google,
method: AuthMethods.Popup
this.counter = store.select('counter');
this.tickets = ticketService.getTickets();
this.ticketService.getTicketsMongo()
tickets => this.ticketMongo = tickets,
error => this.errorMessage = <any>error
addVoto(response: string) {
this.votacion = "Usted eligio: " + response;
onSubmit(value:string):void{
console.log("El formulario tiene", value);
this.store.dispatch({type: INCREMENT});
this.store.dispatch({type: DECREMENT});
this.store.dispatch({type: RESET});
processWithinAngularZone(){
this._ngZone.runOutsideAngular(()=>{
this._increaseProgress(()=>{
this._ngZone.run(()=>{console.log("Finalizado con ngzone")})
_increaseProgress(doneCallBack: ()=>void){
console.log(`Progreso: ${this.progress}%`);
this._increaseProgress(doneCallBack);
verDatos(id:number):void{
this.router.navigate(['/ticket', id ]);
this.datosFirebase.update(key, {estado: 'avanzado'});
this.datosFirebase.remove(key);
this.datosFirebase.remove();