2
當我嘗試保存崇高的文字下面的代碼,JSLint的錯誤:意外表達的意見書「使用嚴格的」
'use strict';
/*global angular,_*/
var app = angular.module("myApp", []);
app.controller("myCtrl", function ($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
});
我正在以下的JSLint錯誤:
#1 Unexpected expression 'use strict' in statement position.
'use strict'; // Line 1, Pos 1
#2 Place the '/*global*/' directive before the first statement.
/*global angular,_*/ // Line 2, Pos 1
#3 Undeclared 'angular'.
var app = angular.module("myApp", []); // Line 4, Pos 11
#4 Expected 'use strict' before '$scope'.
$scope.firstName = "John"; // Line 6, Pos 3
#5 Expected '$scope' at column 5, not column 3.
$scope.lastName = "Doe"; // Line 7, Pos 3
我已經檢查了鏈接@TheSharpieOne。它不符合我的目的。 – Ayan
所以......答案的部分內容是「根據[文檔](http://jslint.com/help.html),JSLint的瀏覽器選項自動禁止在全球範圍內使用」嚴格使用「; 。就我所知,無法重新啓用它。「沒有幫助你意識到你不能把'嚴格使用';'那裏並且把它放在那裏就是問題? – TheSharpieOne
如果沒有使用'嚴格使用',那麼jslint錯誤仍然存在,說'預期'在'$ scope'之前使用嚴格'「 – Ayan