import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {AppService} from "../../../service/appHttpService";

/**
 * Generated class for the SurveyWritePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-survey-write',
  templateUrl: 'survey-write.html',
})
export class SurveyWritePage {

  itemId;
  temp;
  constructor(public navCtrl: NavController, public navParams: NavParams,
              public appService:AppService) {
  }

  ionViewDidLoad() {
    this.itemId = this.navParams.get('item').id;
    this.getDetail();
  }

  getDetail(){
    const id = '';
    this.appService.ObserverHttpGetAdd('/wisdomgroup/modules/question/findQuesByQuestionId/',this.itemId)
        .subscribe((res)=>{
          this.temp = res.json().datalist;
          for(let i = 0;i < this.temp.length;i++){
              this.temp[i].quesDesc = JSON.parse(this.temp[i].quesDesc);
          }
          console.log(this.temp);
        })
  }

}
