0

this is my current formgroup


ngOnInit(){
    this.admQuizForm = this.fb.group({
      name:'',
      desc:'',
      type:'',
      date: new Date(),
      questions: [
       .....what do i do here
      ]
    });
  }

this is my database entry

{"_id":{"$oid":"611b2ba2f29......."},
"name":"quiz1",
"desc":"quiz1",
"type":"history",
"date":"",
"questions":[
{"options":["1","2","3","4"],"question":"whats?","answer":"4"},
{"options":["2","3","4","1"],"question":"whats?","answer":"4"},
{"options":["123","asd","fsa","test"],"question":"whats?","answer":"test"},
{"options":["asd","ads","dsa","aadd"],"question":"whats?","answer":"aadd"}
]}

I'm trying to make a form group to add new quizzes through my website which uses angular and typescript but i'm not sure how arrays work in a form group. I added the data into the database manually.

artyom
  • 1

1 Answers1

0

you need to use FormArray When to use FormGroup vs. FormArray? form group will save use as object and form array will save it as array