2017-12-05 1 views
0

Ich habe diesen Fehler in angularjs5,Typoskript 2.6.1 Fehler TS2554: Voraussichtlich 2-3 Argumente, bekam aber 1

src/app/search/job.search.ts (17,10): Fehler TS2554: Erwartete 2-3 Argumente, aber bekam 1. src/app/search/job.search.ts (21,10): Fehler TS2554: Erwartete 2-3 Argumente, aber bekam 1.

Das ist mein Code:

import { Injectable } from '@angular/core'; 
import { Http, Response } from '@angular/http'; 

import 'rxjs/add/operator/map'; 

@Injectable() 

export class JobSearch{ 

constructor(private _http: Http){} 

private _jobListUrl = 'https://api.shiftjobapp.com/api/v3/job_list?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIzMjQsImlzcyI6Imh0dHA6XC9cL2FwaS5zaGlmdGpvYmFwcC5jb21cL2FwaVwvdjNcL2F1dGhlbnRpY2F0ZV9qb2Jfc2Vla2VyIiwiaWF0IjoxNTEyMzY3OTg1LCJleHAiOjE1MTMyMzE5ODUsIm5iZiI6MTUxMjM2Nzk4NSwianRpIjoiMWQ4NmZkZDYzZDI3YmFiODE0NjA5OTRjOGZhYjI4NTUifQ.3EzNsu154q7a6xFuhQSakBlC-rj1D0HZqLiuwHblNao'; 

private _jobDetailsUrl = 'https://api.shiftjobapp.com/api/v3/job_detailed?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIzMjQsImlzcyI6Imh0dHA6XC9cL2FwaS5zaGlmdGpvYmFwcC5jb21cL2FwaVwvdjNcL2F1dGhlbnRpY2F0ZV9qb2Jfc2Vla2VyIiwiaWF0IjoxNTEyMzY3OTg1LCJleHAiOjE1MTMyMzE5ODUsIm5iZiI6MTUxMjM2Nzk4NSwianRpIjoiMWQ4NmZkZDYzZDI3YmFiODE0NjA5OTRjOGZhYjI4NTUifQ.3EzNsu154q7a6xFuhQSakBlC-rj1D0HZqLiuwHblNao'; 

getJobs(){ 
    return this._http.post(this._jobListUrl) 
     .map((response:Response) => response.json()); 
} 
getJobDetails(){ 
    return this._http.post(this._jobDetailsUrl) 
     .map((response:Response) => response.json()); 
} 

} 

Antwort

0

A POST Anfrage erfordert Daten

Siehe zum Beispiel

addHero (hero: Hero): Observable<Hero> { 
    return this.http.post<Hero>(this.heroesUrl, hero, httpOptions).pipe(
     tap((hero: Hero) => this.log(`added hero w/ id=${hero.id}`)), 
     catchError(this.handleError<Hero>('addHero')) 
    ); 
    } 

von https://angular.io/tutorial/toh-pt6

Verwandte Themen