JShit :期望一个赋值或函数调用,而是看到一个表达式

JShint :Expected an assignment or function call and instead saw an expression

我有这条线:

$scope.campaingstartDate;

并且 JSHint 显示以下消息:

$scope.campaingstartDate;
^ Expected an assignment or function call and instead saw an expression.

我是 Angular JS 和 JSHint 的新手,所以我应该怎么做才能解决这个问题?

如果您的代码按预期工作,但您认为 jshint 太 "strict" 或对该行代码的行为不当,您可以使用以下注释忽略来自 jshint 的警告:

 $scope.campaingstartDate; // jshint ignore:line

或者,您可以按照本页的建议指定默认值。

$scope.campaingstartDate = ''; // add any value as default for your property here