Whenever a web service request fails, this exception is thrown:
TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
Specifically, the HTTP GET request returns a 400 Bad Request error.
Below is the component involved in this issue:
@Component({
selector: 'events-list',
directives: [EventRow],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [HTTP_PROVIDERS],
template: `
<table>
<tr *ngFor="let event of events | async" [event]="event" >
</tr>
</table>
`
})
export class EventsList implements OnInit {
events: Observable<Event[]>;
constructor(public http: Http) { }
ngOnInit(): void {
let obs;
this.events = Observable
.create((o) => {
obs = o;
obs.next();
})
.flatMap(() => {
return this.http.get('event/view');
})
.retryWhen(error => {
error.delay(3000);
})
.map((response: Response) => {
setTimeout(() => {
obs.next();
}, 10000);
return (<any>response.json()).map(item => {
return item;
});
});
}
}
Any suggestions on how to address this issue?
Thank you in advance!