AngularJS智能感知不工作的Visual Studio 2015年 [英] AngularJS intellisense not working on Visual Studio 2015

查看:334
本文介绍了AngularJS智能感知不工作的Visual Studio 2015年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据该<一个href=\"http://blogs.msdn.com/b/visualstudio/archive/2015/02/05/using-angularjs-in-visual-studio-2013.aspx\">post智能感知也应努力在新的2015年VS,但到目前为止,我只得到智能感知角度对象而不是依赖或我的自定义模块。

图像

下面是我所做的:
1增加了angular.intellisense.js到全局JavaScript引用在


  

C:\\ Program Files文件(x86)的\\微软的Visual Studio 14.0 \\ JavaScript的\\参考
  2重新启动的VS2015
  再没有什么,它只是显示感叹号每当我试图将一个HTTP $对象上使用智能感知。


我也将文件添加到同一个地方我angular.js但它仍然没有奏效。我有这种情况下的问题是,我应该在哪里放置文件?与只有我angular.js角公用文件夹,或者在我的开发角度文件夹中的所有文件从鲍尔下载的。

我也试过addind直接到工具/选项/文本编辑器/ javascriptr /智能感知/参考菜单,内隐(网络)对照组,但它仍然没有奏效。

在我的项目,我有src文件夹内的以下文件夹结构:


  • 的wwwroot

    • 应用程序(我的角度网站的东西)

      • 控制器

      • 服务

      • 的意见


    • LIB(JS的依赖,只有每个库的.min.js文件)


      • 角路线

      • ...


    • _references.js(Visual Studio的JS文件的引用,包含参照应用和lib文件夹里面的文件)


  • 库(包含完整的库,由鲍尔下载)


    • 角路线

    • ...


作为一个方面说明,我没有一个/ scripts文件夹,因此没有/scripts/_references.js文件


解决方案

这不是在Visual Studio中的工作对我来说2015年RTM在Web项目中,但我解决了这个问题。

这个项目不是用Visual Studio创建的,并且没有一个 _references.js 文件的任何地方。所以我认为这将是在任何情况下工作。

我删除了所有其他智能感知资源从VS UI中,以确保我所做的就是什么固定它。


  1. 转至 https://www.angularjs.org 并拉起下载对话框。

<醇开始=2>
  • 复制pssed CDN网址的Uncom $ P $。今天,出现这种情况是<一个href=\"https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js\">https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js

  • 在Visual Studio的2015年RTM,转到工具,选项,文本编辑器,使用Javascript,智能感知,引用并粘贴URL在底部文本框,然后点击<大骨节病>添加按钮。点击<大骨节病>确定​​按钮。

  • (可选)如果你想为你创建一个角度提供智能感知(角框架的一部分没有),添加 _references.js 到项目的根目录。不要刻意制造脚本文件夹中。右击它并选择自动同步,然后选择更新。进入它并删除通过构建过程中创建的任何js文件。如果你不这样做,他们可以如此之大,他们将打破智能感知。被prepared为5-10〜秒钟的延迟使用智能感知,因为它从你的项目中加载所有这些引用的第一次。

  • 重新启动Visual Studio 。它不会工作,直到你做到这一点。此外,我偏执收盘比这种情况下首先之外的所有其他实例,因此这些设置大棒。所以我建议你这样做,重新启动该实例之前。

  • According to this post intellisense should also be working on the new VS 2015, but so far I only get intellisense for the angular object and not for the dependencies or my custom modules.

    Here's what I did: 1 Added the angular.intellisense.js to the global javascript references at

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\JavaScript\References 2 Restarted VS2015 And then nothing, it just showed exclamation marks whenever I tried to use intellisense on a $http object.

    I also added the file to the same place as my angular.js but it still didn't work. The question that I have in this case is, where should I place the file? on the angular public folder with only my angular.js, or on my dev angular folder where all the files downloaded from bower are.

    I also tried addind it directly into the tools/options/text editor/javascriptr/intellisense/reference menu, on the Implicit(Web) reference group, but it still didn't work.

    On my project I have the following folder structure inside the src folder:

    • wwwroot
      • app (my angular site stuff)
        • controllers
        • services
        • views
      • lib (js dependencies, only the .min.js file of each library)
        • angular
        • angular-route
        • ....
      • _references.js (the visual studio js references file, contains reference to the files inside the app and lib folders)
    • Libraries (contains the full libraries as downloaded by bower)
      • angular
      • angular-route
      • ...

    As a side note, I don't have a /scripts folder and therefore no /scripts/_references.js file

    .

    解决方案

    This was not working for me in Visual Studio 2015 RTM in a web project, but I solved the problem.

    This project was not created with Visual Studio and does not have a _references.js file anywhere. So I think this will work in any situation.

    I removed all other intellisense resources from within the VS UI to make sure what I did was what fixed it.

    1. Go to https://www.angularjs.org and pull up the download dialog box.

    1. Copy the Uncompressed CDN url. Today that happens to be https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js
    2. In Visual Studio 2015 RTM, go to Tools, Options, Text Editor, Javascript, Intellisense, References and paste the url at the bottom text box and click the Add button. Click the OK button.
    3. (optional) If you want intellisense for the angular providers that you create (not part of the angular framework), add _references.js to the root of your project. Don't bother making a Scripts folder. Right click on it and choose auto-sync, then choose update. Go into it and remove any js files created by a build process. If you don't, they can be so large they will break intellisense. Be prepared for a ~5-10 second delay the first time you use intellisense, as it has to load all these references from your project.
    4. Restart Visual Studio. It will not work until you do this. Also, I'm paranoid about closing all other instances other than this instance first, so these settings "stick". So I suggest you do that before restarting this instance.

    这篇关于AngularJS智能感知不工作的Visual Studio 2015年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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