angularjs $http.delete breaks on ie8

后端 未结 3 1803
情深已故
情深已故 2021-02-19 04:24
$http.delete(\'/api/carts/\' + productCode).
  success(function() {
    cart.products = someMethod();

    updateTotals();
  }).
  error(function() {
    console.log(\'C         


        
3条回答
  •  不知归路
    2021-02-19 05:07

    The problem is that delete is a javascript keyword and IE8 parses it slightly incorrectly. According to the standard, identifiers can be called delete. A quick fix is:

    $http['delete']('/api/carts/' + productCode)
    

    A little ugly, and I don't think the good angular people should have named that method delete, but that fixes your problem

提交回复
热议问题