import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import {EditPage} from "../edit/edit";

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

@IonicPage()
@Component({
  selector: 'page-create',
  templateUrl: 'create.html',
})
export class CreatePage {

  qType;  //题目类型
    lastchange;
    morechange;
  set:{   //设置
      lastchange:'1',
      morechange:'1',
      isAns :''
  };
    optionList = [   //选项
        { desc:'' }
    ]
  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    this.qType = this.navParams.get('type');
    console.log(this.qType);
  }

    addOption(){
      const option = { desc:'' };
      this.optionList.push(option);
    }

    removeOption(i){
      this.optionList.splice(i,1);
    }

    submit(){
      this.navCtrl.push('EditPage');
    }

}
