【发布时间】:2013-03-21 08:37:51
【问题描述】:
我正在开发一个 AngularJs/asp.net mvc4 应用程序,该应用程序通过 asp.net mvc web api 与后端通信。
javascript 文件的缩小是用 mvc4 完成的,但是当我在 Angular 代码中使用 $http.delete 时,mvc4 minifyer 在捆绑文件中返回以下错误:
/* 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
我已经完成了替换保留字(在本例中为“删除”)的解决方法,此处描述为 https://stackoverflow.com/a/13418911/1029874
这意味着$http.delete将被替换为$http.fooDelete,导致angular不再识别它。
是否有其他解决方法或者是使用 jQuery ajax 的最简单解决方案?
【问题讨论】:
-
使用
$http['delete']()并且在AngularJS中尽量不要使用jQuery ajax。
标签: asp.net-mvc-4 angularjs bundling-and-minification