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",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"serve": "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",
|
"build:demo": "ng build --crossOrigin=anonymous --extractCss=true --baseHref=https://framadate-api.cipherbliss.com --aot=true --progress=true --statsJson=true",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
|
@ -10,6 +10,13 @@ export interface DateOption {
|
|||||||
literal: string;
|
literal: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const baseConfigValues = {
|
||||||
|
pollType: "classic",
|
||||||
|
title: "",
|
||||||
|
description: "",
|
||||||
|
myName: "",
|
||||||
|
myEmail: "",
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configuration of the poll, add new fields at will
|
* configuration of the poll, add new fields at will
|
||||||
@ -52,4 +59,11 @@ export class PollConfig {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetConfig() {
|
||||||
|
const self = this;
|
||||||
|
Object.keys(baseConfigValues).forEach((key) => {
|
||||||
|
self[key] = baseConfigValues[key];
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
>
|
>
|
||||||
{{"creation.want"|translate}}
|
{{"creation.want"|translate}}
|
||||||
</span >
|
</span >
|
||||||
|
<button
|
||||||
|
(click)='config.resetConfig()'
|
||||||
|
class='btn btn--warning' >
|
||||||
|
Reset all
|
||||||
|
</button >
|
||||||
<select
|
<select
|
||||||
[(ngModel)]="config.pollType"
|
[(ngModel)]="config.pollType"
|
||||||
autofocus="autofocus"
|
autofocus="autofocus"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<button
|
<button
|
||||||
class="erase btn btn--warning"
|
class="erase btn btn--warning"
|
||||||
[disabled]='!inputModel'
|
*ngIf='inputModel.length'
|
||||||
(click)="eraseInput()" >
|
(click)="eraseInput()" >
|
||||||
<i class="fa fa-times" ></i >
|
<i class="fa fa-times" ></i >
|
||||||
</button >
|
</button >
|
||||||
|
@ -6,15 +6,9 @@ import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|||||||
styleUrls: ['./erasable-input.component.scss']
|
styleUrls: ['./erasable-input.component.scss']
|
||||||
})
|
})
|
||||||
export class ErasableInputComponent implements OnInit {
|
export class ErasableInputComponent implements OnInit {
|
||||||
|
|
||||||
@Output() inputModelChange = new EventEmitter();
|
@Output() inputModelChange = new EventEmitter();
|
||||||
|
|
||||||
@Input() get inputModel() {
|
@Input() inputModel;
|
||||||
return this.inputModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
set inputModel(val) {
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
@ -23,7 +17,7 @@ export class ErasableInputComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eraseInput() {
|
eraseInput() {
|
||||||
this.inputModel = '';
|
//
|
||||||
this.inputModelChange.emit('');
|
this.inputModelChange.emit('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user