patch default form values from loaded poll #105

This commit is contained in:
Tykayn 2021-05-17 17:36:24 +02:00 committed by tykayn
parent a99290186c
commit 4fefa3340c

View File

@ -101,6 +101,10 @@ export class FormComponent implements OnInit {
});
console.log('this.form ', this.form);
// take back values from pollservice
this.form.patchValue(this.pollService.poll);
this.form.patchValue({ creatorPseudo: 'Chuck Norris', creatorEmail: 'chucknorris@example.com' });
if (showDemoValues) {
this.setDemoValues();
this.toastService.display('default values filled for demo');
@ -116,6 +120,10 @@ export class FormComponent implements OnInit {
*/
setDemoValues(): void {
const title = 'le titre de démo oh oh ' + new Date().getTime();
// this.form.patchValue(this.pollService.poll);
// this.form.patchValue({ creatorPseudo: 'Chuck Norris', creatorEmail: 'chucknorris@example.com' });
this.form.patchValue({
title: title,
custom_url: this.pollUtilitiesService.makeSlugFromString(title),
@ -142,14 +150,6 @@ export class FormComponent implements OnInit {
startDateInterval: new Date(),
endDateInterval: new Date(),
comments: [],
// choices: [
// {
// name: 'un choix',
// url: 'https://placekitten.com/120/150',
// },
// ],
// dateChoices: defaultDates,
// timeChoices: defaultTimeOfDay,
});
}