title: How to store array value in database with angular 5
body: <p>In my code option array dosen't work and when i try to bind it with ngModel it didn't work for me and give me 400 bad request. I am include my code here </p>
  
  <p>Here is my 2 model Question model and option model</p>
  
  <p>Question.ts </p>
  
  <pre><code>import { Option } from '../models/option';
  
  export class Question {
  id: number;
  name: string;
  options: Option[] = new Array(4);
  
  constructor(data = null) {
      if (data) {
          this.id = data.id;
          this.name = data.name;
          this.options = data.options; 
      }  
  }
  }
  </code></pre>
  
  <p>Option.ts</p>
  
  <pre><code>export class Option {
  id: number;
  questionId: number;
  option: string;
  isAnswer : boolean;
  
  
  constructor(data = null) {
      if(data){
          this.id = data.id;
          this.questionId = data.questionId;
          this.option = data.option;
          this.isAnswer = data.isAnswer;
      }
  }
  }
  </code></pre>
  
  <p>Here i am include exam.component.ts code</p>
  
  <pre><code>class FormExam {
  id: number;
  name: string;
  options: Option[] = new Array(4);
  
  static formexam(question: Question) {
      let instance = new this;
      instance.id = question.id;
      instance.name = question.name;
      instance.options = question.options;
  
      return instance;
  }
  
  toTask(question: Question) {
      question.id = this.id;
      question.name = this.name;
      question.options = this.options;
  
      return question;
  }
  }
  
  export class ExamComponent implements OnInit {
  @Input() question: Question;
  
  @Output() onSubmit = new EventEmitter();
  
  userModel: User;
  form: FormGroup;
  
  dialogHeader2: string;
  isNewTask: boolean;
  filterStr: string = '';
  isRequestLoading: boolean;
  isValidateLoading: boolean;
  model: FormExam;
  showNameError: boolean;
  stateModel: any;
  stateText: string;
  submitButtonText2: string;
  questionModel: Question;
  
  
   ngOnInit() {
      let task = this.question;
      this.isNewTask = !task;
      this.question = task ? task : new Question();
      this.submitButtonText2 = this.question.id ? 'Save' : 'Create';
      this.model = FormExam.formexam(this.question);
  
  }
  </code></pre>
  
  <p>Here is html code and in this code when i am using [(ngModel)] in option and isAnswer didn't work for me .</p>
  
  <pre><code>&lt;div class="ct-form-block"&gt;
      &lt;div&gt;
          &lt;label class="ct-form-label"&gt;Question&lt;/label&gt;
          &lt;ct-textarea [name]="'name'" [maxlength]="200" [(ngModel)]="model.name"&gt;  &lt;/ct-textarea&gt;
  
      &lt;/div&gt;
  
      &lt;div *ngFor="let option of model.options;"&gt;
  
          &lt;label class="ct-form-label"&gt; Options&lt;/label&gt;
          &lt;div class="ct-required-field-container "&gt;
              &lt;input class="ct-input ct-full-width2"
                     name="options" [(ngModel)]="option.option"/&gt;
  
              &lt;input type="checkbox" name="Options" [(ngModel)]="option.isAnswer" /&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>in this code model.option and model.isAnswer dosen't work because when i am submit this code it gives me bad request 400 error so is there any other way to store this value in database .</p>