Body of Http.DELETE request in Angular2

前端 未结 12 1988
旧巷少年郎
旧巷少年郎 2020-12-02 08:23

I\'m trying to talk to a somewhat RESTful API from an Angular 2 frontend.

To remove some item from a collection, I need to send some other data in addition to the re

12条回答
  •  爱一瞬间的悲伤
    2020-12-02 09:15

    In Angular Http 7, the DELETE method accepts as a second parameter options object in which you provide the request parameters as params object along with the headers object. This is different than Angular6.

    See example:

    this.httpClient.delete('https://api-url', {
        headers: {},
        params: {
            'param1': paramValue1,
            'param2': paramValue2
        }
    });
    

提交回复
热议问题