Page have multiple input field.
<div class="form-group w-100">
<label class="col-md-3 text-left" for="">Box 2</label>
<input
class="form-control ml-2 mr-2"
[value]="MenuBox2"
[style.background]="MenuBox2"
[(colorPicker)]="MenuBox2"
(colorPickerChange)="updateFirestoreColor($event)"
/>
</div>
<div class="form-group w-100">
<label class="col-md-3 text-left" for="">Box 2 Text</label>
class="form-control ml-2 mr-2"
[value]="MenuBox2Text"
[style.background]="MenuBox2Text"
[(colorPicker)]="MenuBox2Text"
(colorPickerChange)="updateFirestoreColor($event)"
/>
</div>
<div class="form-group w-100">
<label class="col-md-3 text-left" for="">Box 2 Hover Text</label>
<input
class="form-control ml-2 mr-2"
[value]="MenuBox2Hover"
[style.background]="MenuBox2Hover"
[(colorPicker)]="MenuBox2Hover"
(colorPickerChange)="updateFirestoreColor($event)"
/>
</div>
All these field are color picker using ngx-color-picker
package.
I am trying to get the value of each input field and store in firestore
.
updateFirestoreColor(event: any) {
this.afs.collection('General').doc('colors').update(event);
}
Problem What is the best solution to use single function for all fields, to get the value of respected field.
TIA