gpt4 book ai didi

javascript - 如何将 @Gbuomprisco/ng2-tag-input 与 angular-cli 一起使用?

转载 作者:行者123 更新时间:2023-11-28 18:07:01 25 4
gpt4 key购买 nike

我正在使用最新版本的 @angular/cli (1.0.0-beta.32.3),并且我正在尝试使用 ng2-tag-input 。当我启动 ngserve 命令时,出现此错误:

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 5:22 in the original .ts file), resolving symbol Ng2DropdownModule in my-project/node_modules/ng2-tag-input/dist/node_modules/ng2-material-dropdown/index.d.ts, resolving symbol TagInputModule in my-project/node_modules/ng2-tag-input/dist/modules/ng2-tag-input.module.d.ts, resolving symbol TagInputModule in my-project/node_modules/ng2-tag-input/dist/modules/ng2-tag-input.module.d.ts
webpack: Failed to compile.

知道如何解决这个问题吗?

这是我的 package.json:

{
"name": "my-project",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor",
"build": "ng build --aot"
},
"private": true,
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"bootstrap-sass": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"jquery": "^3.1.1",
"ng2-tag-input": "^0.8.5",
"rxjs": "^5.0.1",
"tinymce": "^4.5.3",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "^1.0.0-beta.32.3",
"@angular/compiler-cli": "^2.3.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"@types/tinymce": "^4.5.0",
"angular-cli": "1.0.0-beta.26",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.3"
}
}

和我的app.module.ts

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { FormsModule } from "@angular/forms";
import { HttpModule } from "@angular/http";
import { TagInputModule } from 'ng2-tag-input';
import { RouterModule } from "@angular/router";
import { ROUTES } from "./app.routes";
import { AppComponent } from "./app.component";

@NgModule({
declarations: [ AppComponent ],
imports: [
BrowserModule,
FormsModule,
HttpModule,
TagInputModule,
RouterModule.forRoot(ROUTES, { useHash: true })
],
providers: [ ],
bootstrap: [AppComponent]
})
export class AppModule {
}

感谢您的帮助!

最佳答案

正如 Galvan 所建议的,使用 ng2-tag-input 0.8.6 版本拯救了我的一天(谢谢!)。

npm i ng2-tag-input@0.8.6 --save

我已提交 issue这样他们就可以更新 npm 注册表

关于javascript - 如何将 @Gbuomprisco/ng2-tag-input 与 angular-cli 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42368360/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com