javascript - Failed to instantiate module formlyBootstrap - Stack Overflow

I've installed angular-formly-templates-bootstrap via bower on a project that I've been worki

I've installed angular-formly-templates-bootstrap via bower on a project that I've been working on. But when I try to inject it in angular, I receive the following error:

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.
.4.1/$injector/nomod?p0=formlyBootstrap
    at http://localhost:3000/bower_ponents/angular/angular.js:68:12
    at http://localhost:3000/bower_ponents/angular/angular.js:1949:17
    at ensure (http://localhost:3000/bower_ponents/angular/angular.js:1873:38)
    at module (http://localhost:3000/bower_ponents/angular/angular.js:1947:14)
    at http://localhost:3000/bower_ponents/angular/angular.js:4355:22
    at forEach (http://localhost:3000/bower_ponents/angular/angular.js:336:20)
    at loadModules (http://localhost:3000/bower_ponents/angular/angular.js:4339:5)
    at http://localhost:3000/bower_ponents/angular/angular.js:4356:40
    at forEach (http://localhost:3000/bower_ponents/angular/angular.js:336:20)
    at loadModules (http://localhost:3000/bower_ponents/angular/angular.js:4339:5)

The problem is, bower doesn't load angular-formly-templates-bootstrap in the browser. There are some other packages which are being loaded to the browser with bower. But I don't know what the problem is with formlyBootstrap.

I've installed angular-formly-templates-bootstrap via bower on a project that I've been working on. But when I try to inject it in angular, I receive the following error:

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/1.4.1/$injector/nomod?p0=formlyBootstrap
    at http://localhost:3000/bower_ponents/angular/angular.js:68:12
    at http://localhost:3000/bower_ponents/angular/angular.js:1949:17
    at ensure (http://localhost:3000/bower_ponents/angular/angular.js:1873:38)
    at module (http://localhost:3000/bower_ponents/angular/angular.js:1947:14)
    at http://localhost:3000/bower_ponents/angular/angular.js:4355:22
    at forEach (http://localhost:3000/bower_ponents/angular/angular.js:336:20)
    at loadModules (http://localhost:3000/bower_ponents/angular/angular.js:4339:5)
    at http://localhost:3000/bower_ponents/angular/angular.js:4356:40
    at forEach (http://localhost:3000/bower_ponents/angular/angular.js:336:20)
    at loadModules (http://localhost:3000/bower_ponents/angular/angular.js:4339:5)

The problem is, bower doesn't load angular-formly-templates-bootstrap in the browser. There are some other packages which are being loaded to the browser with bower. But I don't know what the problem is with formlyBootstrap.

Share Improve this question edited Jul 14, 2015 at 12:34 Masious asked Jul 14, 2015 at 12:18 MasiousMasious 4305 silver badges14 bronze badges 5
  • Angular can't find the module so it looks like you've either not defined it, not defined it correctly or you've not loaded it in you HTML page. – Matt Herbstritt Commented Jul 14, 2015 at 12:28
  • I added some extra explanations. I hope it helps... @MattHerbstritt – Masious Commented Jul 14, 2015 at 12:35
  • those templates don't work properly with bower without reconfiguring them yourself – charlietfl Commented Jul 14, 2015 at 12:44
  • @charlietfl I couldn't find something about reconfiguring it, in its documantation. Are there any documents exlpaining the correct way to do it?! – Masious Commented Jul 14, 2015 at 12:56
  • Are you certain that you've included the angular-formly-templates-bootstrap script on the page? This is what all the examples are doing. Also, make certain that you include it before your custom scripts. – kentcdodds Commented Jul 14, 2015 at 16:39
Add a ment  | 

2 Answers 2

Reset to default 12

Are you using gulp for inject bower dependencies? If so, find in gulp config something like that

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

So all files ended with 'bootstrap.js' not injected. You can chage it with something like that

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

Got the same error. I was working with gulp angular generator which seems to be ignoring formly bootstrap. I changed the main file in bower_ponents for angular-formly-bootstrap-template to dist/...bootstrap.min.js. Started working after that. Seems like the generator was ignoring files having bootstrap.js at the end

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744387528a4571742.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信