import { Component, OnInit } from '@angular/core';
import {CommonService} from '../common.service';

@Component({
  selector: 'app-age',
  templateUrl: './age.component.html',
  styleUrls: ['./age.component.css']
})
export class AgeComponent implements OnInit {
  curPageData:Array<any>;
  isShow: boolean;
  curQues: Object;
  curQuesIndex: number;
  curQuestionSelecte: string;
  constructor(private commonService: CommonService) { }

  ngOnInit() {
    this.surveyInfo()
  }
  surveyInfo() {
    this.commonService.surveyInfo().then(res => {
      if (res['success']) {
        this.curPageData = res['data']['survey'].pages['2']
        console.log(this.curPageData)
      }
    })
  }

  showToast(question, idx) {
    this.isShow = true
    this.curQues = question
    this.curQuesIndex = idx
    this.curQuestionSelecte = question.name

  }

  closeToast() {
    this.isShow = false
  }
}
