提交数据

import {Http,Jsonp,Headers} from "@angular/http";

private headers = new Headers({'Content-Type': 'application/json'});

this.http.post('http://localhost:8008/api/test',
JSON.stringify({username: 'admin'}), {headers:this.headers})
.subscribe(function(res){
  console.log(res.json());
});

原文地址:https://www.cnblogs.com/yuyedaocao/p/9326786.html