import { Component, OnInit,Input, Output, EventEmitter} from '@angular/core';

@Component({
  selector: 'app-page15',
  templateUrl: './page15.component.html',
  styleUrls: ['./page15.component.css']
})
export class Page15Component implements OnInit {
  @Input() curPageData: Array<any>
  @Output() getAllAnswer = new EventEmitter<any>()
  curQues: Object
  curAllQues: Object
  constructor() { }

  ngOnInit() {
    console.log(this.curPageData)
  }

  getAnswer(option){
    const questionId = this.curQues['questionId']
    this.curAllQues[questionId] = option
    const questions = Object.keys(this.curAllQues).map(questionId => {
      return { questionId, options: this.curAllQues[questionId] }
    })
    const ret = {
      pageId: 15,
      questions
    }
    this.getAllAnswer.emit(ret)
  }
}
