As indicated in another answer, it interval
is a static function, so it does not exist on the prototype Observable
, which is why your error is executed.
, , timer
.
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/timer';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/switchMap';
@Effect()
onLoadTasksLoadTasks$: Observable<Action> = this.actions$
.ofType(tasksActions.ActionTypes.LOAD_TASKS)
.switchMap(() => Observable
.timer(0, 10000)
.switchMap(() => this.TS.index()
.map((res) => new tasksActions.LoadTasksSuccessAction(res.json()))
.catch(err => Observable.of(new tasksActions.LoadTasksFailAction(err)))
)
);
timer
, , . , LOAD_TASKS
, switchMap
, timer
..