我正在尝试发送http请求,但我面对标题中提到的错误它如此常见但我怎么能在我的Ts组件中处理它(调用makecall()函数):
import { Component,OnInit, ViewEncapsulation } from '@angular/core';
import {DomSanitizer } from "@angular/platform-browser";
import {Http, Response, Headers} from '@angular/http';
@Component({
selector: 'app-twitter',
templateUrl: '../templates/twitter.component.html',
styleUrls: ['../styles/twitter.component.css'],
encapsulation:ViewEncapsulation.None
})
export class TwitterComponent {
constructor(private domSanitizer : DomSanitizer, private http_:Http){
}
makecall() {
var headers = new Headers();
headers.append('Content-Type', 'application/X-www-form-urlencoded');
this.http_.post('http://localhost:3000/authorize', {headers: headers}).subscribe((res) => {
console.log(res);
})
}
}