angularjs $ http.delete打破了ie8 [英] angularjs $http.delete breaks on ie8
本文介绍了angularjs $ http.delete打破了ie8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$http.delete('/api/carts/' + productCode).
success(function() {
cart.products = someMethod();
updateTotals();
}).
error(function() {
console.log('Could not remove product from card: ' + productCode);
});
IE8在第一行抱怨预期标识符。该代码在Firefox,Chrome等中运行良好。
IE8 complains that "expected identifier" on the first line. The code works fine in Firefox, Chrome, etc.
推荐答案
问题在于 delete
是一个javascript关键字,IE8稍微错误地解析它。根据标准,标识符可以称为 delete
。快速解决方法是:
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
这篇关于angularjs $ http.delete打破了ie8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文