You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hinzufuegen.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import Component from '@glimmer/component';
  2. import { tracked } from '@glimmer/tracking';
  3. import { action } from '@ember/object';
  4. import { inject as service } from '@ember/service';
  5. export default class HinzufuegenController extends Component {
  6. @tracked titel;
  7. @tracked kategorie;
  8. @tracked menge;
  9. @tracked einheit;
  10. @tracked bild;
  11. @tracked id;
  12. @tracked isselected;
  13. @service store;
  14. @action speichern()
  15. {
  16. let produkt = this.store.createRecord('produkt', {
  17. type: 'produkt',
  18. id: this.titel.split(' ').join(''),
  19. //attributes: {
  20. titel: this.titel,
  21. kategorie: this.kategorie,
  22. menge: this.menge,
  23. einheit: this.einheit,
  24. bild: this.bild,
  25. isselected: false
  26. //}
  27. })
  28. //produkt._promiseProxy = true;
  29. produkt.save();
  30. this.store.findAll('produkt').then(function (suchergebnis) {
  31. suchergebnis.forEach(element => {
  32. if (element.titel != undefined) {
  33. }
  34. });
  35. });
  36. this.titel = null;
  37. this.kategorie = null;
  38. this.menge = null;
  39. this.einheit = null;
  40. this.bild = null;
  41. this.id = null;
  42. }
  43. }