![](/img/trans.png)
[英]IntelliSense for Ajax and JavaScript libraries in Visual Studio
[英]Enabling javascript intellisense for external libraries in Visual Studio
我用~/Scripts/_references.js
更新了~/Scripts/_references.js
/// <autosync enabled="true" />
/// <reference path="angular.js" />
/// <reference path="angular-route.js" />
在我的app.js
我可以看到一些intellisense工作,这很棒
但是走得更远,它不再起作用了。
有关为什么会发生这种情况或使其发挥作用的任何想法?
因为您正在使用dependency injection
,所以Visual Studio无法确定参数的类型。
这是Javascript intellisense的常见问题,并且由于Javascript不允许显式类型注释,似乎没有明确的方法来解决它。
但是,这可以使用Typescript (具有VS2013扩展)和角度类型轻松实现,其中代码如下所示:
angular.module('example', ['ngRoute'])
.config([ '$locationProvider',
function ($locationProvider : ng.ILocationProvider) {
$locationProvider. // Intellisense would work here.
}
]);
我建了一个库就可以做到这一点:
https://github.com/jmbledsoe/angularjs-visualstudio-intellisense
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.