From 4fefa3340c282bd963b3e12433f1d6d4afc2917c Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 17 May 2021 17:36:24 +0200 Subject: [PATCH] patch default form values from loaded poll #105 --- .../administration/form/form.component.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/features/administration/form/form.component.ts b/src/app/features/administration/form/form.component.ts index 7434602f..837c11cf 100644 --- a/src/app/features/administration/form/form.component.ts +++ b/src/app/features/administration/form/form.component.ts @@ -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, }); }