forked from tykayn/funky-framadate-front
🐛 fix recursion in input erase button
This commit is contained in:
parent
a68cbdcc0a
commit
195259bb72
@ -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",
|
||||
|
@ -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];
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<button
|
||||
class="erase btn btn--warning"
|
||||
[disabled]='!inputModel'
|
||||
*ngIf='inputModel.length'
|
||||
(click)="eraseInput()" >
|
||||
<i class="fa fa-times" ></i >
|
||||
</button >
|
||||
|
@ -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('');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user