Skip to content Skip to sidebar Skip to footer

Typescript Rxjs Observable Array Concat

I am having trouble using rxjs Observable.concat function with typescript. Getting an error 'Cannot read property 'apply' of undefined' The problem seems to be only within typescri

Solution 1:

OK, Problem solved.

Important note for users of reactive js version 5: In typescript with rxjs, to minimize app size each operator must be specifically imported for the function/operator to be included. So the line...

import {concat} from 'rxjs/operators/concat' must be inlcuded at the top of the typescript file for concat to work.

What confused me was that I was getting intellisense in VS2015 for the Observable.concat function even though the function had not actually been imported.


Solution 2:

I'm using rxjs 5.5.7 and had to use import 'rxjs/add/observable/concat';.

The code itself looks like: Observable.concat(...observables).subscribe etc


Post a Comment for "Typescript Rxjs Observable Array Concat"