TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

前端 未结 20 1157
时光说笑
时光说笑 2020-12-01 06:22

I am trying to map from a service call but getting an error. Looked at subscribe is not defined in angular 2? and it said that in order to subscribe we need to

20条回答
  •  情话喂你
    2020-12-01 06:30

    Can be triggered by a stray comma (,) in an RxJS pipe(...)

    The compile won't catch this extra comma at the end:

    pipe(first(), map(result => ({ event: 'completed', result: result}),);
    

    It becomes an 'invisible' undefined operator which screws the whole pipe up, and leads to a very confusing error message - which in this case has nothing to do with my actual logic.

提交回复
热议问题