|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
export class AppComponent { |
|
|
export class AppComponent { |
|
|
|
|
|
|
|
|
|
|
|
title = 'Einkaufszettel'; |
|
|
|
|
|
entries: BlogEntry[] = []; |
|
|
|
|
|
isSubmitted = false; |
|
|
|
|
|
Kategorien: any = ['Lebensmittel', 'Spielwaren', 'Technik', 'Sonstiges']; |
|
|
|
|
|
|
|
|
constructor(public fb: FormBuilder) { |
|
|
constructor(public fb: FormBuilder) { |
|
|
this.entries = []; |
|
|
this.entries = []; |
|
|
this.entries = initialEntries; |
|
|
this.entries = initialEntries; |
|
|
|
|
|
|
|
|
get kategorieName() { |
|
|
get kategorieName() { |
|
|
return this.registrationForm.get('kategorieName'); |
|
|
return this.registrationForm.get('kategorieName'); |
|
|
} |
|
|
} |
|
|
title = 'Einkaufszettel'; |
|
|
|
|
|
entries: BlogEntry[] = []; |
|
|
|
|
|
isSubmitted = false; |
|
|
|
|
|
// Kategorien |
|
|
|
|
|
Kategorien: any = ['Lebensmittel', 'Spielwaren', 'Technik', 'Sonstiges']; |
|
|
|
|
|
|
|
|
|
|
|
/*########### Form ###########*/ |
|
|
/*########### Form ###########*/ |
|
|
registrationForm = this.fb.group({ |
|
|
registrationForm = this.fb.group({ |
|
|
|
|
|
|
|
|
this.entries.push(entry); |
|
|
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 |
|
|
// Kategorie mit Drop Down Menu wählen |
|
|
changeKategorie(e) { |
|
|
changeKategorie(e) { |
|
|
console.log(e.value); |
|
|
console.log(e.value); |