-1
Guys, I’m trying to do an http post to send a json to the server but it’s giving an error. My code is as follows
the Imports
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, FormBuilder } from "@angular/forms";
import { Http } from '@angular/http';
import { map } from 'rxjs/operators';
and here’s my http post
onSubmit() {
console.log(this.formulario.value)
this.http
.post('https://httpbin.org/post', JSON.stringify(this.formulario.value)).pipe(
.map(res => res))
.subscribe(dados => console.log(dados))
}
Thanks man, it was killing me here hahah! Thanks!
– Fernando Munhoz