Angular6 角6后置前缀http://localhost:4200/

Angular6 角6后置前缀http://localhost:4200/,angular6,Angular6,我试图将JSON文件发布到RESTful端点,但请求总是在其前缀“”处 代码: app.component.ts import {Component } from '@angular/core'; import {HttpClient} from '@angular/common/http'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: './app.compo

我试图将JSON文件发布到RESTful端点,但请求总是在其前缀“”处

代码:

app.component.ts

import {Component } from '@angular/core';
import {HttpClient} from '@angular/common/http';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: './app.component.css'
})

export class AppComponent {
  private _url = 'website.com';
  private _url2 = './assets/data/rfdata2.json';

  public newGet = this.http.post(this._url, this._url2);

  constructor(private http: HttpClient) {
    this.newGet.subscribe(data => this.getArray = data);
  }
}
/assets/data/rfdata2.json

[
  {"frequency":2440.000, "name": "sig1", "id": "{mf0382mf4q8392-28nm3fq- q2u389mqf}"},
  {"frequency":2460.000, "name": "sig2", "id": "{39n893-48398anjh9n8na-0398wnf}"},
  {"frequency":2480.000, "name": "sig3", "id": "{fanb8903y84-may7md9a387kfa7m8}"}
]
错误文本

ERROR Object { headers: Object, status: 404, statusText: "Not Found", url: "http://localhost:4200/website.com", ok: false, name: "HttpErrorResponse", message: "Http failure response for http://we…", error: "<!DOCTYPE html> <html lang="en"> <h…" }

错误对象{标题:对象,状态:404,状态文本:“未找到”,url:http://localhost:4200/website.com,ok:false,名称:“HttpErrorResponse”,消息:“Http失败响应http://we…,错误:“向URL添加协议


private\u url='1〕https://website.com“;

哦,我应该注意到的。谢谢!