ERROR! The console is outputting a message stating that TypeError: params[item].split
is not a function. I would greatly appreciate any assistance in resolving this issue. Understanding where I went wrong in tackling this problem would be the most beneficial help.
routeReady() {
this.activeRoute.queryParams
.pipe(switchMap(params => {
if (!params['filter']) {
// using previous month as default
let date : Date = new Date();
date.setDate(1);
date.setMonth(date.getMonth() - 1);
this.formData.startDate = DateUtils.dateToText(date);
date.setDate(DateUtils.getDaysInMonth(date));
this.formData.endDate = DateUtils.dateToText(date);
}
['startDate', 'endDate', 'club'
, 'subscription', 'sold'].forEach(item => {
if (item in params && params[item] !== '') {
this.formData[item] = params[item];
}
});
['courts', 'groups', 'zones'].forEach(item => {
if (item in params && params[item] !== '') {
this.formData[item] = params[item].split(',');
}
});
return Promise.resolve(true);
}))
.subscribe();
}
This error has me stumped: