Renew Page which has form and fetches items from other page

The way you are accessing items seems to me like it is always going to return Firebase’s /Items. If you want greater control over that, I would suggest losing the AsyncPipe and instead subscribing and updating a controller property that you manage yourself.

Some other things:

  • please get rid of all instances of any
  • it seems weird that you have both AngularFire and direct firebase access
  • date-fns > moment
  • having both formControlName and [(ngModel)] is also weird
  • declaring Camera in a page’s providers is inefficient, because it gets built up / torn down per page
  • do not store Loading in properties - it enables reuse bugs
  • const is less than worthless
  • there is no need for direct DOM access (document.getElementById())
  • never type the word “function” inside of one
  • always prefer let over var
  • I don’t understand how getTotal() is intended to be used, but as written it is incorrectly named. Nothing named getXXX() should modify state.
  • forms cannot nest
1 Like