postDemo() { const params = new HttpParams(); params.set('aaa', '111111'); params.set('bbb', '22222'); this._httpClient.post('http://127.0.0.1:12345/snap/timer', params). subscribe( (res) => { console.log(res); }, (err) => { console.log(err); } ); }
服務器注意跨域配置,相似echo的跨域
c.Response().Header().Set("Access-Control-Allow-Origin", "*")