Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. private retrieveSavedControls(options: string): FormArray{
  2. console.log(classes);
  3. this.profileForm= this.fb.group({
  4. optionGroups: this.fb.array([])
  5. })
  6. const control = <FormArray>this.profileForm.controls['optionGroups'];
  7.  
  8. this.units = JSON.parse(options).optionGroups;
  9. console.log('parsed json: ',this.units);
  10. let index =0;
  11. this.units.forEach(unit => {
  12.  
  13. control.push(this.fb.group({
  14. selectInput: ['', Validators.required],
  15. whereInput: [[], Validators.required]
  16. }));
  17. // this part should've loaded the list for each of the 2nd dropdown but not loading.
  18. this.wheres[unit.selectInput] = this.getWhere().filter((item)=> item.selectid == unit.selectInput);
  19.  
  20. (<FormArray>this.profileForm.controls['optionGroups']).controls[index]
  21. .patchValue({ selectInput: unit.selectInput, whereInput: unit.whereInput});
  22. index++
  23. })
  24. console.log('control: ',control)
  25. return control;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement