注意:这是一个WebStorm问题,而不是angular.js问题。
Screencast的问题:http://f.cl.ly/items/302s0d1k1i3i1B2p0W09/ws703-angular-not-defined.mp4
描述:
<script src="vendor/js/angular.min.js"></script> <script src="app/js/scratch.js"></script>
在scratch.js中,当我引用“角”时,我不断得到这个来自JSHint的“角度没有定义”的消息。如何让它如此被定义在这个文件中,所以JSHint停止抱怨呢?这是配置问题吗?请指教。
WebStorm v7.0.3 / Mac OSX v10.9.1
documentation page of JSHint的第一个例子如下:
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 } }
替换MY_GLOBAL有角度,你不会再有这个JSHint警告了。