import { Component,ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams,ModalController,Content,Slides } from 'ionic-angular';



@IonicPage()
@Component({
  selector: 'page-brake',
  templateUrl: 'brake.html',
})
export class BrakePage {
  currentIndex:any;
  slidertab:any;

  @ViewChild(Content) content: Content;
  @ViewChild('mySlider') slider: Slides;

  constructor(public navCtrl: NavController, public navParams: NavParams) {
    let id = this.navParams.get("id");
    this.slidertab = id;
    console.log("id", id);
    setTimeout(() => {
    this.goToSlide(id);
    }, 500)
    this.slidertab = 0;
  }

  goToSlide(id) {
    this.slider.slideTo(id, 500);
    }
    
    slideChanged() {
    let currentIndex = this.slider.getActiveIndex();
    this.slidertab = currentIndex;
    console.log("Current index is", currentIndex);
    }

  back()
  {
    this.navCtrl.pop();
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad BrakePage');
  }

}
