I'm trying to filer an Observable in my angular project, but it says: "... .map is not a function" so, can you explain what's wrong with my code?
tasks.component.ts (map also imported from rxjs/operators)
ngOnInit() {
this.tasks = this.tasksService.tasks.map(x => x.filter(y => y.isDone == this.completed));
this.tasksService.getTasks();
}
And here's my service which provides the Observable:
task.service.ts
export class TasksService {
private _tasks = new BehaviorSubject<Task[]>([]);
tasks = this._tasks.asObservable();
constructor(private http : Http) {
console.log('Tasks Service is initialized...');
}
getTasks() {
this.http.get(URL).subscribe(x => {
this._tasks.next(x.json());
});
}
HttpModuleit is deprecated you should useHttpClientModuleHttpModule? you are just assuming I guess ...