rxjs6

Error: Property 'map' does not exist on type 'Observable'

别来无恙 提交于 2020-01-11 13:36:11
问题 After I updated angular/cli, I got an error: error TS2339: Property 'map' does not exist on type 'Observable<Response>' I tried every possible solution from Property 'map' does not exist on type 'Observable<Response>' but still the error exists. 回答1: Its easy to post an answer when you provide your code instead of a screenshot. Anyhow , you have to pipe it: getUsers() { return this._http.get(this.baseUrl+'/show-users', this.options) .pipe( map((response:Response)=>response.json()) ); Remember

How to make a sequence of http requests in Angular 6 using RxJS

試著忘記壹切 提交于 2020-01-09 11:28:11
问题 I've been looking for a solution all over the web, but couldn't find anything that fits my user case. I'm using the MEAN stack (Angular 6) and I have a registration form. I'm looking for a way to execute multiple HTTP calls to the API and each one is dependent on the returned result from the previous one. I need something that looks like this: firstPOSTCallToAPI('url', data).pipe( result1 => secondPOSTCallToAPI('url', result1) result2 => thirdPOSTCallToAPI('url', result2) result3 =>

How to make a sequence of http requests in Angular 6 using RxJS

£可爱£侵袭症+ 提交于 2020-01-09 11:25:40
问题 I've been looking for a solution all over the web, but couldn't find anything that fits my user case. I'm using the MEAN stack (Angular 6) and I have a registration form. I'm looking for a way to execute multiple HTTP calls to the API and each one is dependent on the returned result from the previous one. I need something that looks like this: firstPOSTCallToAPI('url', data).pipe( result1 => secondPOSTCallToAPI('url', result1) result2 => thirdPOSTCallToAPI('url', result2) result3 =>

Angular 6 : where getting error module “rxjs/add/operator/map” and another error 'map' does not exist on type 'Observable<Response>'

陌路散爱 提交于 2019-12-30 17:20:30
问题 I am using Angular 6 where I am getting two errors - ERROR in ./src/app/app/img/img.service.ts Module not found: Error: Can't resolve 'rxjs/add/operator/map' in '/Users/user/Projects/A4/imageSearch/src/app/app/img' ERROR in src/app/app/img/img.service.ts(21,9): error TS2339: Property 'map' does not exist on type 'Observable'. 回答1: I faced similar problem with rxjs map operator. Currently I'm using Angular 6. To know which version you are using: ng --version or ng -v If you are also using

Angular 6 : where getting error module “rxjs/add/operator/map” and another error 'map' does not exist on type 'Observable<Response>'

拈花ヽ惹草 提交于 2019-12-30 17:19:49
问题 I am using Angular 6 where I am getting two errors - ERROR in ./src/app/app/img/img.service.ts Module not found: Error: Can't resolve 'rxjs/add/operator/map' in '/Users/user/Projects/A4/imageSearch/src/app/app/img' ERROR in src/app/app/img/img.service.ts(21,9): error TS2339: Property 'map' does not exist on type 'Observable'. 回答1: I faced similar problem with rxjs map operator. Currently I'm using Angular 6. To know which version you are using: ng --version or ng -v If you are also using

forkJoin is deprecated: resultSelector is deprecated, pipe to map instead

半腔热情 提交于 2019-12-30 05:33:05
问题 I'm working on an Angular 6 project. Running ng lint gives the following Warning: "forkJoin is deprecated: resultSelector is deprecated, pipe to map instead" forkJoin(...observables).subscribe( Any idea? Can't seem to find any information about this deprecation. I just generated a brand new Angular application "ng new forkApp" with Angular CLI: 6.1.5 source: import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { forkJoin } from 'rxjs';

Angular : how to call finally() with RXJS 6

落花浮王杯 提交于 2019-12-30 01:47:16
问题 I was using RXJS 5, now as I upgraded it to 6, I am facing some problems. Previously I was able to use catch and finally but as per update catch is replaced with catchError (with in the pipe) now how to use finally? Also I have some questions : Do I need to change throw->throwError (in below code Observable.throw(err);) import { Observable, Subject, EMPTY, throwError } from "rxjs"; import { catchError } from 'rxjs/operators'; return next.handle(clonedreq).pipe( catchError((err:

RXJS/Angular Prevent multiple HTTP on multiple subscribers

不羁岁月 提交于 2019-12-25 01:15:51
问题 I have "mainData" service, it consists of 3 parts: currentPage used by paginator component to switch page. Can be updated at any point. folders contains all folders in the current folder. There are 2 components that use this observable (Types of listing of folder content) files contains all files in the current folder. There are 3 components that use this observable (Types of listing of folder content) The default view is the one without folders, thus I would like not to make unnecessary HTTP

Angular 6 - problem executing nested .subscribe() “next” function

南楼画角 提交于 2019-12-24 19:47:33
问题 I've created an app with user authentication system. Firstly I check if user with given registration e-mail exists and if does not - I call registration service. register.component.ts registerUser(email: String, password: String) { let found = false; this.authService.findUser(email).pipe( tap(res => { console.log(res.status); if (res.status === 202) { found = true; } else if (res.status === 200) { found = false; } else {found = null; }}), concatMap(res => { console.log(found); if (found) {

Problem with Observable after update app to Angular 7 and RxJS 6.3.3

廉价感情. 提交于 2019-12-24 14:13:24
问题 I updated my app to Angular 7 and RxJS 6.3.3 and I've got a problems during making changes into my code. I really need help with that, because I can't to find solution into google or stack overflow. My imports: import { Observable, of } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; import { Injectable, Inject, Optional, InjectionToken } from '@angular/core'; import { Headers, ResponseContentType, Response } from '@angular/http'; import { HttpClient } from '@angular/common