🐛 fix recursion in input erase button

This commit is contained in:
Baptiste Lemoine 2020-01-21 12:30:53 +01:00
parent a68cbdcc0a
commit 195259bb72
6 changed files with 825 additions and 1023 deletions

View File

@ -5,7 +5,7 @@
"ng": "ng",
"start": "ng serve",
"serve": "ng serve",
"build": "ng build",
"build": "ng build --crossOrigin=anonymous --aot=false",
"build:demo": "ng build --crossOrigin=anonymous --extractCss=true --baseHref=https://framadate-api.cipherbliss.com --aot=true --progress=true --statsJson=true",
"test": "ng test",
"lint": "ng lint",

View File

@ -10,6 +10,13 @@ export interface DateOption {
literal: string;
}
const baseConfigValues = {
pollType: "classic",
title: "",
description: "",
myName: "",
myEmail: "",
};
/**
* configuration of the poll, add new fields at will
@ -52,4 +59,11 @@ export class PollConfig {
constructor() {
}
resetConfig() {
const self = this;
Object.keys(baseConfigValues).forEach((key) => {
self[key] = baseConfigValues[key];
})
}
}

View File

@ -9,6 +9,11 @@
>
{{"creation.want"|translate}}
</span >
<button
(click)='config.resetConfig()'
class='btn btn--warning' >
Reset all
</button >
<select
[(ngModel)]="config.pollType"
autofocus="autofocus"

View File

@ -1,6 +1,6 @@
<button
class="erase btn btn--warning"
[disabled]='!inputModel'
*ngIf='inputModel.length'
(click)="eraseInput()" >
<i class="fa fa-times" ></i >
</button >

View File

@ -6,15 +6,9 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
styleUrls: ['./erasable-input.component.scss']
})
export class ErasableInputComponent implements OnInit {
@Output() inputModelChange = new EventEmitter();
@Input() get inputModel() {
return this.inputModel;
}
set inputModel(val) {
}
@Input() inputModel;
constructor() {
}
@ -23,7 +17,7 @@ export class ErasableInputComponent implements OnInit {
}
eraseInput() {
this.inputModel = '';
//
this.inputModelChange.emit('');
}

1815
yarn.lock

File diff suppressed because it is too large Load Diff