now i have function getDays as getDays() { this.workingDays = [];…
Jump to turn (10)
- 1now i have function getDays as getDays() { this.workingDays = []; this.storeLoca
- 2what is getSelectedDays i don't have function called this
- 3this is my editfunction editStore( store: any) { this.editView = true; this.stor
- 4give me errors that the id of days is null despite the workingDays array have id
- 5this.workingDays.forEach((day, index) => { const currentDay = this.storeRequest[
- 6currentDay.hrFrom = day.hrFrom; currentDay.hrTo = day.hrTo; returned by empty st
- 7ok now i want to empty workingDays and push in it only currentDay not append on
- 8but i want to take the id from the old data
- 9the id os existing in workingDays array not in storeRequest
- 10if i empty workingDays before foreach how can i take the id
- User
now i have function getDays as getDays() { this.workingDays = []; this.storeLocatorServ.getDays().subscribe((response: any) => { response.data.forEach(d => { this.workingDays.push({ id: d.id, dayEn: d.dayEn, hrFrom: "", hrTo: "", closed: false, fullDay: false, }) }); }) } and have editfunction give me the data of selectedDays from specific API and save the response of days in this.storeRequest['days'] = response.data.days; i want to map this days but this daysid didn't return by API i want to clear empty workingDays and refill it by data returned from API plus takes the id from workingDays before empty modify in this this.storeRequest['days'] = response.data.days; this.workingDays=[]; this.storeRequest['days'].map(day => { const matchingDay = this.storeRequest['days'].find(d => d.day.toLowerCase() === day.day.toLowerCase()); const dayToPush = {...matchingDay, hrFrom: this.convertToMilitaryTime(matchingDay.hrFrom), hrTo: this.convertToMilitaryTime(matchingDay.hrTo),}; this.workingDays.push(dayToPush)
- Assistant