无法实例化模块 formlyBootstrap

Failed to instantiate module formlyBootstrap

我已经通过 bower 安装了 angular-formly-templates-bootstrap 我一直在从事的项目。但是当我尝试在 angular 中注入它时,我收到以下错误:

Uncaught Error: [$injector:modulerr] Failed to instantiate module bandar due to:
Error: [$injector:modulerr] Failed to instantiate module formlyBootstrap due to:
Error: [$injector:nomod] Module 'formlyBootstrap' 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.4.1/$injector/nomod?p0=formlyBootstrap
    at http://localhost:3000/bower_components/angular/angular.js:68:12
    at http://localhost:3000/bower_components/angular/angular.js:1949:17
    at ensure (http://localhost:3000/bower_components/angular/angular.js:1873:38)
    at module (http://localhost:3000/bower_components/angular/angular.js:1947:14)
    at http://localhost:3000/bower_components/angular/angular.js:4355:22
    at forEach (http://localhost:3000/bower_components/angular/angular.js:336:20)
    at loadModules (http://localhost:3000/bower_components/angular/angular.js:4339:5)
    at http://localhost:3000/bower_components/angular/angular.js:4356:40
    at forEach (http://localhost:3000/bower_components/angular/angular.js:336:20)
    at loadModules (http://localhost:3000/bower_components/angular/angular.js:4339:5)

问题是,Bower 不会在浏览器中加载 angular-formly-templates-bootstrap。还有一些其他包正在使用 bower 加载到浏览器。但是我不知道 formlyBootstrap.

有什么问题

遇到同样的错误。我正在使用 gulp angular 生成器,它似乎正式忽略了 bootstrap。我将 bower_components 中的主文件更改为 angular-formly-bootstrap-template 到 dist/...bootstrap.min.js。之后就开始工作了。似乎生成器忽略了结尾 bootstrap.js 的文件

您是否使用 gulp 来注入 Bower 依赖项?如果是这样,请在 gulp 配置中找到类似的东西

exports.wiredep = {
  exclude: [/bootstrap.js$/, /bootstrap-sass-official\/.*\.js/, /bootstrap\.css/],
  directory: 'bower_components'
};

所以所有以'bootstrap.js'结尾的文件都没有注入。你可以用类似的东西改变它

exports.wiredep = {
  exclude: [/[^-]bootstrap.js$/, /bootstrap-sass-official\/.*\.js/, /bootstrap\.css/],
  directory: 'bower_components'
};