-this is my saved list-
export const FORMULARLIST: formular[] = [
{ id: 1, name: 'Max Mustermann', mobileNumber: 123456, secondMobileNumber: 654321, email: '[email protected]', secondEmail: '[email protected]', roomNumber: 'A101', task: "Rechenzentrum" },];
-this is my interface-
export interface formular {
id: number;
name: string;
mobileNumber: number;
secondMobileNumber: number;
email: string;
secondEmail: string;
roomNumber: string;
task: string;
}
-And that is the function that should add an element to the array. What it does, but as soon as I put something in my box from my input field in the html file, the list changes too-
addNew(){
FORMULARLIST.push(this.formular);
}
-the button with the function-
<input (click)="addNew()" type="submit" value="Add" class="btn btn-success" />
-The Html data with the input box-
<span class="input-group-text" id="basic-addon1">Aufgabe:</span>
<input id="newtask" [(ngModel)]="formular.task" type="text" class="form-control" placeholder="Aufgabe" aria-label="Username" aria-describedby="basic-addon1">
´´´ I don't know how to add one element without changing the other ´´´