|
|
@@ -8,6 +8,11 @@ import {FormBuilder, Validators} from '@angular/forms'; |
|
|
|
}) |
|
|
|
export class AppComponent { |
|
|
|
|
|
|
|
title = 'Einkaufszettel'; |
|
|
|
entries: BlogEntry[] = []; |
|
|
|
isSubmitted = false; |
|
|
|
Kategorien: any = ['Lebensmittel', 'Spielwaren', 'Technik', 'Sonstiges']; |
|
|
|
|
|
|
|
constructor(public fb: FormBuilder) { |
|
|
|
this.entries = []; |
|
|
|
this.entries = initialEntries; |
|
|
@@ -17,11 +22,6 @@ export class AppComponent { |
|
|
|
get kategorieName() { |
|
|
|
return this.registrationForm.get('kategorieName'); |
|
|
|
} |
|
|
|
title = 'Einkaufszettel'; |
|
|
|
entries: BlogEntry[] = []; |
|
|
|
isSubmitted = false; |
|
|
|
// Kategorien |
|
|
|
Kategorien: any = ['Lebensmittel', 'Spielwaren', 'Technik', 'Sonstiges']; |
|
|
|
|
|
|
|
/*########### Form ###########*/ |
|
|
|
registrationForm = this.fb.group({ |
|
|
@@ -42,7 +42,20 @@ export class AppComponent { |
|
|
|
this.entries.push(entry); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
deleteAllEntries() { |
|
|
|
console.log(this.entries.length); |
|
|
|
const index: number = this.entries.length; |
|
|
|
if (index !== -1) { |
|
|
|
this.entries = this.entries.splice(index, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
deleteLastEntry() { |
|
|
|
console.log(this.entries.length); |
|
|
|
const index: number = this.entries.length; |
|
|
|
if (index !== -1) { |
|
|
|
this.entries.splice(index-1, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
// Kategorie mit Drop Down Menu wählen |
|
|
|
changeKategorie(e) { |
|
|
|
console.log(e.value); |