I'm working on an AngularJs/asp.net mvc4 app that communicates with the backend through asp.net mvc web api.
The minification of javascript files is done with mvc4, but when i use $http.delete in angular code, the mvc4 minifyer return following error in the bundled file:
/* Minification failed. Returning unminified contents.
(1029,11-17): run-time warning JS1010: Expected identifier: delete
(1029,11-17): run-time error JS1137: 'delete' is a new reserved word and should not be used as an identifier: delete
I have done a workaround that replaces reserved words (in this case 'delete'), which is described here, http://stackoverflow.com/a/13418911/1029874
This means that $http.delete will be replaced with $http.fooDelete, resulting that angular do not recognize it any more.
Is there another workaround or is the simplest solution to use jQuery ajax instead?
@larchii use $http'delete' as @stewie mentioned. As per this article, use of any of the IE reserved words causes the expected identifier error to be thrown. There is also a link to the list of reserved words for IE. Hope this helps.
I have the same issue but my workaround will be to do this instead of using the shortcuts:
$http({method: 'DELETE', url: '/someUrl'}).
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});