I am trying to send http request, but I face with error mentioned in title its so common but how can I handle it in my Ts component here it is(calling makecall() function):
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);
})
}
}