Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     @ViewChild('injectParameterInput', {read: ViewContainerRef}) parameterInputGroup;
  2.      
  3.     constructor(private cfr: ComponentFactoryResolver) {}
  4.    
  5.     addSourceForm = new FormGroup({
  6.         url: new FormControl(''),
  7.         parameters: new FormArray([])
  8.     })
  9.    
  10.     addParameterInput() {
  11.         const componentFactory = this.cfr.resolveComponentFactory(ParameterInputComponent)
  12.         const compRef = this.parameterInputGroup.createComponent(componentFactory)
  13.    
  14.         let array = this.addSourceForm.controls.parameters as FormArray
  15.        
  16.         // array.push(new FormControl('')) ???
  17.    
  18.         compRef.instance.requestDestroy.subscribe(() => {
  19.           compRef.destroy()
  20.         })
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement