Property 'subscribe' does not exist on type 'Subscription

user10081175

Here by using GET method, I'm getting the applied jobs list. This code is from appliedJobsPage

this.getjobs.getAppliedjobList().subscribe(data => {
      this.appliedjobs = data;
    })

This is my provider page getJobs

getAppliedjobList() {
    let headers = new Headers();
    headers.append('Content-Type','application/json');
    return this.http.get('http://localhost:3000/api/appliedjobs',{headers: headers})
    .map(res => res.json())
    .subscribe(data => {
      this.jobslist = data;
    });
  } 

I'm getting error as

Property 'subscribe' does not exist on type 'Subscription'. Did you mean 'unsubscribe'?
edkeveked

You're having this error because you have already subscribed to the observable.

map(res => res.json())
    .subscribe(data => {
      this.jobslist = data;
    });

If you're using angular version 5 or later you don't need this map(res => res.json()). At any rate, you need to remove the subscription to the observable in your service so that you can subscribe to the observable in your component. Remove the following in your service:

.subscribe(data => {
          this.jobslist = data;
        });

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

'Property does not exist on type 'never'

分類Dev

Property 'xxx' does not exist on type '{}'

分類Dev

Firebase error when subscribing to ref.on(‘value’, callback); | Property 'subscribe' does not exist on type '(a: DataSnapshot, b?: string) => any'

分類Dev

Property 'values' does not exist on type 'ObjectConstructor'

分類Dev

Property 'values' does not exist on type 'ObjectConstructor'

分類Dev

property then does not exist on type void , A typescript error

分類Dev

TSLint: Property 'params' does not exist on type 'NavigationState'

分類Dev

Property 'entries' does not exist on type ObjectConstructor

分類Dev

Property 'innerText' does not exist on type 'Element'

分類Dev

Property 'VAR_PLURAL' does not exist on type

分類Dev

Typescript: Property 'DB' does not exist on type 'Global'

分類Dev

Property 'detailed' does not exist on type 'Console'

分類Dev

Typescript property does not exist on union type

分類Dev

Property 'store' does not exist on type 'Readonly<AppInitialProps

分類Dev

Generic property 'enabled' does not exist on type 'Node'?

分類Dev

How to define a property to avoid: Property 'X' does not exist on type 'Y'

分類Dev

How to prevent "Property '...' does not exist on type 'Global'" with jsdom and typescript?

分類Dev

Angular 5 to 6 Upgrade: Property 'map' does not exist on type Observable

分類Dev

how to fix property does not exist on type 'Object' in ionic 3?

分類Dev

useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'

分類Dev

Angular 6 : Property 'fromEvent' does not exist on type 'typeof Observable'

分類Dev

Angular 5 : Property 'then' does not exist on type 'Observable<any>'

分類Dev

Property 'XYZ' does not exist on type 'Readonly<{ children?: ReactNode; }> & Readonly<{}>'

分類Dev

Typescript - property scan does not exist on type Subject...?

分類Dev

Property 'filter' does not exist on type 'Object'. When trying to filter response

分類Dev

ES6: Property 'selected' does not exist on type 'Object'

分類Dev

Property 'controls' does not exist on type 'AbstractControl'. in angular 8

分類Dev

Property 'background' does not exist on type '{}' - React Router modal

分類Dev

Property 'setUser' does not exist on type 'Readonly<{}> & Readonly<{ children?: ReactNode; }>'

Related 関連記事

  1. 1

    'Property does not exist on type 'never'

  2. 2

    Property 'xxx' does not exist on type '{}'

  3. 3

    Firebase error when subscribing to ref.on(‘value’, callback); | Property 'subscribe' does not exist on type '(a: DataSnapshot, b?: string) => any'

  4. 4

    Property 'values' does not exist on type 'ObjectConstructor'

  5. 5

    Property 'values' does not exist on type 'ObjectConstructor'

  6. 6

    property then does not exist on type void , A typescript error

  7. 7

    TSLint: Property 'params' does not exist on type 'NavigationState'

  8. 8

    Property 'entries' does not exist on type ObjectConstructor

  9. 9

    Property 'innerText' does not exist on type 'Element'

  10. 10

    Property 'VAR_PLURAL' does not exist on type

  11. 11

    Typescript: Property 'DB' does not exist on type 'Global'

  12. 12

    Property 'detailed' does not exist on type 'Console'

  13. 13

    Typescript property does not exist on union type

  14. 14

    Property 'store' does not exist on type 'Readonly<AppInitialProps

  15. 15

    Generic property 'enabled' does not exist on type 'Node'?

  16. 16

    How to define a property to avoid: Property 'X' does not exist on type 'Y'

  17. 17

    How to prevent "Property '...' does not exist on type 'Global'" with jsdom and typescript?

  18. 18

    Angular 5 to 6 Upgrade: Property 'map' does not exist on type Observable

  19. 19

    how to fix property does not exist on type 'Object' in ionic 3?

  20. 20

    useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'

  21. 21

    Angular 6 : Property 'fromEvent' does not exist on type 'typeof Observable'

  22. 22

    Angular 5 : Property 'then' does not exist on type 'Observable<any>'

  23. 23

    Property 'XYZ' does not exist on type 'Readonly<{ children?: ReactNode; }> & Readonly<{}>'

  24. 24

    Typescript - property scan does not exist on type Subject...?

  25. 25

    Property 'filter' does not exist on type 'Object'. When trying to filter response

  26. 26

    ES6: Property 'selected' does not exist on type 'Object'

  27. 27

    Property 'controls' does not exist on type 'AbstractControl'. in angular 8

  28. 28

    Property 'background' does not exist on type '{}' - React Router modal

  29. 29

    Property 'setUser' does not exist on type 'Readonly<{}> & Readonly<{ children?: ReactNode; }>'

ホットタグ

アーカイブ