Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ion-input *ngIf="property.component == 'number'"
- type="number" [attr.id]="property.id"
- [formControlName]="property.label">
- </ion-input>
- private createFormGroup = (question: SurveyQuestion) => {
- const formGroup = this.formBuilder.group({
- [question.label]: this.formBuilder.array([])
- });
- const items = formGroup.get(question.label) as FormArray;
- question.properties.forEach((property, index) => {
- let validatorArray = [];
- if (!property.is_optional)
- {
- validatorArray.push(Validators.required);
- }
- //Other validators are added to array here
- items.push(this.formBuilder.group({
- [property.label]: new FormControl("", Validators.compose(validatorArray))
- }))
- });
- return formGroup;
- };
Add Comment
Please, Sign In to add comment