我的一个控制器中有这个脚本:
function AdIssueListCtrl($scope, $http, $rootScope, $compile) {
$rootScope.nav = {
adsSideNav: true
};
//datasource for kendoui interface
$scope.kendo_adissues = new kendo.data.DataSource({
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
transport: {
read: {
url: "/ads/adissue/kendo/?template=ads/ajax/json/list_adissue_kendo.html",
dataType: "json"
}
},
schema: {
total: "count",
data: 'fields'
},
sort: {'field': 'name', dir: 'asc'}
});
//delete
$scope.delete = function (id) {
var deleteuser = confirm("Are you sure you wish to delete this issue and all it's ads?");
if (deleteuser) {
$http.get("/ads/adissue/delete/" + id + "/").success(function (data) {
if (data.result == 'success') {
$scope.kendo_adissues.read();
}
});
}
};
//bind data
$scope.cdb = function (e) {
var grid = $("#adissues_grid");
$compile(grid.contents())($scope);
};
}
AdIssueListCtrl.$inject = ['$scope', '$compile', '$rootScope', '$http'];
我在 jetbrains PHPStorm 中使用 filewatcher 进行关闭,它基本上在代码更改时运行以下内容。
compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --js $FileName$
其中 $FileName$ 是当前打开的文件。出于某种原因,我收到以下错误。
ERROR - Parse error. missing name after . operator
$scope.delete = function (id) {
^
controllers.js:47: ERROR - Parse error. syntax error
}
^
controllers.js:48: ERROR - Parse error. syntax error
AdIssueListCtrl.$inject = ['$scope', '$compile', '$rootScope', '$http'];
该脚本在未缩小的情况下工作正常,但我不知道为什么它会抛出那些解析器错误?有任何想法吗?