我想知道如何在我的Angular 2项目中使用ng2-tag-input库。我的Angular 2项目是从angular-cli 1.0.0-beta.24开始的。该项目使用的是Angular 2.3.1,因此我将ng2-tag-input版本设置为0.4.8,并在angular-cli.json文件中插入以下行。
"scripts": [
"../node_modules/ng2-tag-input/dist/ng2-tag-input.bundle.js"
]在app.module.ts中,我将"TagInputModule“插入到导入数组中。但是<tag-input>没有工作,我得到了这个错误。
发布于 2017-02-14 17:23:04
1)安装库npm install ng2-tag-input --save
2)导入TagInputModule到您的模块中
import { TagInputModule } from 'ng2-tag-input';
@NgModule({
imports: [ TagInputModule ]
})
export class YourModule {}3)除非您使用的是SystemJS (Angular-cli现在使用的是Webpack),否则不需要添加其他配置。
https://stackoverflow.com/questions/41842140
复制相似问题