Last active
October 27, 2017 19:21
-
-
Save mrtcmn/a24cfa4cd854cd832645de1664df3f98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component} from '@angular/core'; | |
import { FormBuilder, FormGroup, FormsModule, FormArray } from '@angular/forms'; // Import required forms modules | |
@Component({ | |
selector: 'form-creator-form' | |
templateUrl: './formCreatorForm.component.html' | |
}) | |
export class formCreatorComponent implements { | |
_FormGroup: FormGroup; // We need to define FormGroup variables. | |
constructor( private fb: FormBuilder) { // Define FormBuilder to "fb" for direct access. | |
this._FormGroup = this.fb.group({ | |
formName: '', | |
decs: '', | |
questions: this.fb.array([this.fb.group({ | |
question: '', | |
questionType: '', | |
answers: this.fb.array([ | |
this.fb.group({ value: ''}) | |
]) | |
})]) | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment