关于IntelliJ的Angular 2代码建议

时间:2016-05-13 22:05:16

标签: intellij-idea autocomplete typescript angular

我看到本月早些时候发布了Angular2 RC,我玩了几个月的测试版,所以我决定删除angular2 beta模块

npm uninstall angular2

然后我使用了angular2快速入门教程中的package.json来安装RC版本:

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common":  "2.0.0-rc.1",
    "@angular/compiler":  "2.0.0-rc.1",
    "@angular/core":  "2.0.0-rc.1",
    "@angular/http":  "2.0.0-rc.1",
    "@angular/platform-browser":  "2.0.0-rc.1",
    "@angular/platform-browser-dynamic":  "2.0.0-rc.1",
    "@angular/router":  "2.0.0-rc.1",
    "@angular/router-deprecated":  "2.0.0-rc.1",
    "@angular/upgrade":  "2.0.0-rc.1",

    "systemjs": "0.19.27",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",

    "angular2-in-memory-web-api": "0.0.7",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^0.8.1"
  }
}

我的应用程序在进行一些导入重写后工作正常,但现在,我的IDE上的角度框架不再具有自动完成功能。

例如,IntelliJ无法识别模板中的* ngIf指令

这是我的tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

我是否需要配置其他内容才能使其再次运行?

感谢您的回答

3 个答案:

答案 0 :(得分:2)

根据comment in the IntelliJ bug tracker,修正了2016.1.2 EAP中的问题。我更新到2016.1.3 EAP,或更具体地说:

IntelliJ IDEA (Minerva) IU-145.1503.17
Build #IU-145.1503, built on May 20, 2016

它为我解决了这个问题。

答案 1 :(得分:0)

我建议使用WebStorm,Jetbrains的以网络为中心的IDE。它为Angular 2提供了开箱即用的支持,甚至还有一个用于运行npm脚本的精美界面。

https://www.jetbrains.com/webstorm

答案 2 :(得分:-1)

您可以尝试ang2-autocomplete 以下是使用示例:plnkr.co/edit/5zRD0fcOZHXEMOk4kupY?p=preview

相关问题