Http Post No Angular

-1

Well, I'm trying to make an http post to send a json to the server but it's giving an error. My code looks like this

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))

}

    
asked by anonymous 25.10.2018 / 05:49

1 answer

0

If you use the pipe, you do not need the point before the map.

.post('https://httpbin.org/post', JSON.stringify(this.formulario.value)).pipe
(map(res => res))
    
25.10.2018 / 15:55