关于delete的错误: angularjs $http.delete breaks on ie8

$scope.del = function(id){
        tips.showConfirm('确定要取消该收藏?', function(){
            $apis.delete(API.COMPONENT+'/api/component/favourite/'+id,function(r){
                if(r.result=="success"){
                    tips.showSuccess("成功取消收藏!");
                    $scope.loadFavours();
                }else{
                    tips.showFailure(r.data.content);
                }
            });
        });
    };      

在IE8下,会显示消息: 缺少标识符,即IE8 complains that "expected identifier" on the first line. The code works fine in Firefox, Chrome, etc.

这是因为delete是javascript的关键词,IE8错误的解析了它,一个解决办法是:$apis['delete'](API.COMPONENT+...


$http.delete(path)也可以使用$http['delete'],同时也可以使用original mode:$http({method: 'DELETE', url: path})

原文地址:https://www.cnblogs.com/shiddong/p/5474062.html