start combine choices array

This commit is contained in:
Baptiste Lemoine 2020-10-31 17:36:54 +01:00
parent b0026fabc4
commit 4bec5828b3
2 changed files with 37 additions and 1 deletions

View File

@ -33,7 +33,26 @@
<i class="fa fa-close"></i> <i class="fa fa-close"></i>
</button> </button>
<label for="descr">Description</label> <br />
<h2>Choix de réponse</h2>
<div formArrayName="choicesFormArray">
<h3>Aliases</h3>
<button (click)="addChoice()">Add Alias</button>
<div *ngFor="let choice of choices.controls; let i = index">
<!-- The repeated alias template -->
<pre class="debug padded warning">
choice :
{{ choice | json }}
</pre
>
<label>
choices:
<input type="text" [formControlName]="i" />
</label>
</div>
</div>
<label for="descr">Description (optionnel)</label>
<textarea <textarea
#description #description
matInput matInput
@ -86,6 +105,16 @@
</div> </div>
<div class="complete" *ngIf="longFormVersionEnabled"> <div class="complete" *ngIf="longFormVersionEnabled">
<form [formGroup]="configurationFormGroup"> <form [formGroup]="configurationFormGroup">
<h2>
Type de sondage
</h2>
<button class="btn" [ngClass]="{ 'is-primary': isAboutDate.value }" (click)="isAboutDate = true">
Spécial date
</button>
<button [ngClass]="{ 'is-primary': !isAboutDate.value }" (click)="isAboutDate = false">
Classique - textes
</button>
<h2>Version complète du formulaire</h2> <h2>Version complète du formulaire</h2>
<mat-form-field appearance="outline" class="is-flex"> <mat-form-field appearance="outline" class="is-flex">
<mat-label>Nombre de jours avant expiration</mat-label> <mat-label>Nombre de jours avant expiration</mat-label>

View File

@ -80,4 +80,11 @@ export class FormComponent implements OnInit {
let newValueFormatted = 'TODO'; let newValueFormatted = 'TODO';
this.pollFormGroup.patchValue({ slug: newValueFormatted }); this.pollFormGroup.patchValue({ slug: newValueFormatted });
} }
get choices() {
return this.choicesFormArray.get('aliases') as FormArray;
}
addChoice() {
this.choices.push(this.fb.control(''));
}
} }