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


@IonicPage()
@Component({
  selector: 'page-landing',
  templateUrl: 'landing.html',
})
export class LandingPage {
	
	@ViewChild(Slides) slides: Slides;
	currentIndex:any;
	
	constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage) {
		
		this.currentIndex=0;
		
		this.storage.get('landing_pg').then((landing_pg) => {
			 
				if(landing_pg){
					this.navCtrl.push('LoginPage');
				}
		})
	}

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

	goToNextSlide() {
		this.slides.slideNext();
		this.slides.getActiveIndex();
		console.log("fsfsf");
	}
	goToPrevSlide() {
		this.slides.slidePrev();
		this.slides.getActiveIndex();
	}

	slideChanged() {
		this.currentIndex = this.slides.getActiveIndex();
		console.log(this.currentIndex);
	}

	login(){
		this.storage.set('landing_pg',1).then(()=>{
		})
		this.navCtrl.push("LoginPage");
	}

}
