如何使用 AngularJS 和 Bootstrap 将 ngTagsInput 导入到您的项目中?

How do you import ngTagsInput into your project with AngularJS and Bootstrap?

如何在尝试使用 ngTagsInput 时防止出现此消息?我试着去模块并输入:

var app = angular.module("SinglePageApplication", [ "ngRoute",  'ui.bootstrap', 'ngTagsInput']);

然而,这总是在下面抛出以下错误。

Uncaught Error: [$injector:modulerr] Failed to instantiate module SinglePageApplication due to:
Error: [$injector:modulerr] Failed to instantiate module ngTagsInput due to:
Error: [$injector:nomod] Module 'ngTagsInput' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.8/$injector/nomod?p0=ngTagsInput

此外,我尝试安装它,使用此 link 并调用命令:

$ npm install ng-tags-input@3.1.1 --save

但这总是会引发错误:

UNMET PEER DEPENDENCY grunt@1.0.1
└── ng-tags-input@3.1.1

我想要的只是能够使用标签输入,但是我觉得我缺少一些重要的东西来解决所有这些问题。如果有任何帮助,我将不胜感激。

我记得 运行 遇到过这个问题,我想到的 fix/workaround 是在本地复制 ng-tags-input.js 并将其保存在 .git 中。

我完全忘了检查这个,当时 Angular >= 1.5 有一个错误。无法准确回忆起该错误,但我认为我的问题是在按下回车键时它会 select 下拉列表中的一项,而不是提交输入。