Closed jonolo-3 closed 5 years ago
Hi, I'm getting back undefined when trying to retrieve the key for a section in schedule.service.ts. I'm on angular 7+ and rxjs 6+.
This snippet is the problem. I'm always getting id = undefined leading to that I am always going to createSection.
items$ = this.itemList$.pipe( withLatestFrom(this.section$), map(([items, section]: any[]) => {
const id = section.data.$key; const defaults: ScheduleItem = { workouts: null, meals: null, section: section.section, timestamp: new Date(section.day).getTime() }; const payload = { ...(id ? section.data : defaults), ...items }; console.log(id); if (id) { console.log('updateSection'); return this.updateSection(id, payload); } else { console.log('createSection'); return this.createSection(payload); } })
);
Hi, I'm getting back undefined when trying to retrieve the key for a section in schedule.service.ts. I'm on angular 7+ and rxjs 6+.
This snippet is the problem. I'm always getting id = undefined leading to that I am always going to createSection.
items$ = this.itemList$.pipe( withLatestFrom(this.section$), map(([items, section]: any[]) => {
);