0
私はAngular 4で以下のサービスを提供しています。私のサーバに情報を投稿しようとすると、 "http://localhost:4200"が私のリクエストに適用され、結果は "http://localhost:4200/localhost:5000/login"です。どのように私はこれを解決できますか?投稿リクエストからベースURLを削除する
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable()
export class AuthService {
constructor(private http: HttpClient) { }
public authFunc(payload) {
const headers = new HttpHeaders();
headers.set('Content-Type', 'application/json');
console.log(this.http.post);
return this.http.post("http:/localhost:5000/login", payload, {headers: headers});
}
}
あなたは '/'を見逃しました。これは 'http://'でなければなりません。 –
それは間違いでした。どうもありがとうございました!!! –