Angular http.post without .subscribe callback

后端 未结 5 2166
野的像风
野的像风 2020-12-05 23:56

I\'m wondering if I can make just a http post request without subscribing on callbacks, something like this

 this._http.post(\'/list/items/u         


        
5条回答
  •  猫巷女王i
    2020-12-06 00:10

    I'm using conversion to Promise (requires rxjs):

    import 'rxjs/add/operator/toPromise';
    @Injectable()
    export class SomeService {
    ....
      post(sp: Seatplace, date?: Date) : Promise {
         return this.http.post(
           '/list/items/update?itemId=' + itemId + "&done=" + done, 
            null
         ).toPromise();
      }
    }
    

提交回复
热议问题