WebStorm - "角"没有被定义 [英] WebStorm - "angular" is not defined

查看:815
本文介绍了WebStorm - "角"没有被定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意:这是一个WebStorm问题,而不是一个angular.js问题

问题

截屏:<一href=\"http://f.cl.ly/items/302s0d1k1i3i1B2p0W09/ws703-angular-not-defined.mp4\">http://f.cl.ly/items/302s0d1k1i3i1B2p0W09/ws703-angular-not-defined.mp4

说明:

我在我的index.html文件如下:

 &LT;脚本SRC =供应商/ JS / angular.min.js&GT;&LT; / SCRIPT&GT;
&LT;脚本SRC =应用程序/ JS / scratch.js&GT;&LT; / SCRIPT&GT;

在scratch.js当我引用角我不断收到来自JSHint这个角没有定义的消息。我该如何使它所以角在这个文件中,以便JSHint停止抱怨它定义为见过?这是一个配置问题?请指教。

WebStorm v7.0.3 / Mac OSX版v10.9.1


解决方案

在JSHint 的文档页面的第一个示例如下:


  

配置文件是指定JSHint选项中打开它或关闭一个简单的JSON文件。例如,下面的文件将使有关未定义和未使用的变量警告,并告诉JSHint有关名为MY_GLOBAL全局变量。


  {
  民主基金:真实,
  未使用:真实,
  全局:{MY_GLOBAL:虚假}
}

替换 MY_GLOBAL ,你不会有这样的JSHint了警告。

NOTE: This is a WebStorm issue, not an angular.js issue.

Screencast of the problem: http://f.cl.ly/items/302s0d1k1i3i1B2p0W09/ws703-angular-not-defined.mp4

Description:

I have the following in my index.html file:

<script src="vendor/js/angular.min.js"></script>
<script src="app/js/scratch.js"></script>

In scratch.js when I reference "angular" I keep getting this "angular is not defined" message from JSHint. How do I make it so angular is seen as defined in this file so JSHint stops complaining about it? Is this a configuration issue? Please advise.

WebStorm v7.0.3 / Mac OSX v10.9.1

解决方案

The very first example in the documentation page of JSHint is the following:

Configuration file is a simple JSON file that specifies which JSHint options to turn on or off. For example, the following file will enable warnings about undefined and unused variables and tell JSHint about a global variable named MY_GLOBAL.

{
  "undef": true,
  "unused": true,
  "globals": { "MY_GLOBAL": false }
}

Replace MY_GLOBAL with angular, and you won't have this JSHint warning anymore.

这篇关于WebStorm - &QUOT;角&QUOT;没有被定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆