title: Dynamic form array with dynamic options
body: <p>I want to make a student able to choose several workshops in a dynamic number of school subjects</p>
  
  <p>1.- I have a config array, this array have the number of options of the student will choose for every subject</p>
  
  <pre><code>let configarray = {initdate: 2019-07-01, subjectnumber: 4};
  </code></pre>
  
  <p>In this example for every subject the student will be able to choose 4 options.</p>
  
  <pre><code>let b = this.FormGuardar.get("opciontaller") as FormArray; 
  for (let i = 0; i &lt; configarray.subjectnumber; i++) {
       let preregistro = this._fb.group({
           preregistroid: [],
           alumnoporcicloid:[],
           tallercurricularid: []
           });
           b.push(preregistro);
           this.arrayopcion.push({ taller: this.tallerselect }); //tallerselect will display
  the options of every subject every subject will have a diferent options
  </code></pre>
  
  <p>Also when i select a options this is my code for erase the selected option in the other selects in the configurations.</p>
  
  <pre><code>    selectedTaller(id, index) {
      let seleccionados = [];
      let array = this.FormGuardar.get("opciontaller").value;
      for (let a of array) {
          if (a.tallercurricularid) {
              seleccionados.push(a.tallercurricularid);
          }
      }
  
      let disponibles = this.SelectTaller.filter(function (item) {
          return seleccionados.indexOf(item.tallercurricularid) == -1;
      });
  
      for (let i = 0; i &lt; this.arrayopcion.length; i++) {
          let data = [...disponibles],
              control = ((this.FormGuardar.controls.opciontaller as FormArray).controls[i] as FormGroup).controls.tallercurricularid as FormControl,
              seleccionado = this.SelectTaller.find(x =&gt; x.tallercurricularid == control.value);
          (((this.FormGuardar.controls.opciontaller as FormArray).controls[i] as FormGroup).controls.clasificadorparaescolarid as FormControl).setValue(seleccionado ? seleccionado.clasificadorparaescolaresid.clasificadorparaescolaresid : null);
          seleccionado ? data.push(seleccionado) : null;
          this.arrayopcion[i].taller = data;
          seleccionado ? control.setValue(seleccionado.tallercurricularid) : null;
      }
  }
  </code></pre>
  
  <p>The question here is how can i make this code work for a dynamic number of subjects with a dynamic options for every workshops?</p>