问题描述:

I am trying to use the the angular bootstrap when i try to add the dependency in my controller and start the server with grunt serve i get a blank page.Please have a look at the bower components in the screen shot.

When i try to use it in angular.module('kbv1App', ['ui.bootstrap']).controller it fails if i remove the [ui.bootstrap] it works fine.

Any idea wha will be the issue?

Update. Console error

[$injector:modulerr] Failed to instantiate module ui.bootstrap due to: [$injector:nomod] Module 'ui.bootstrap' 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.2.18/$injector/nomod?p0=ui.bootstrap minErr/<@http://localhost:9000/bower_components/angular/angular.js:78:5 setupModuleLoader/</module/<@http://localhost:9000/bower_components/angular/angular.js:1645:1 [email protected]://localhost:9000/bower_components/angular/angular.js:1567:5 [email protected]://localhost:9000/bower_components/angular/angular.js:1641:7 createInjector/loadModules/<@http://localhost:9000/bower_components/angular/angular.js:3817:11 [email protected]://localhost:9000/bower_components/angular/angular.js:320:7 [email protected]://localhost:9000/bower_components/angular/angular.js:3811:5 createInjector/loadModules/<@http://localhost:9000/bower_components/angular/angular.js:3818:11 [email protected]://localhost:9000/bower_components/angular/angular.js:320:7 [email protected]://localhost:9000/bower_components/angular/angular.js:3811:5 [email protected]://localhost:9000/bower_components/angular/angular.js:3751:3 bootstrap/[email protected]://localhost:9000/bower_components/angular/angular.js:1410:1 [email protected]://localhost:9000/bower_components/angular/angular.js:1425:5 [email protected]://localhost:9000/bower_components/angular/angular.js:1338:5 @http://localhost:9000/bower_components/angular/angular.js:21713:5 jQuery.Callbacks/[email protected]://localhost:9000/bower_components/jquery/dist/jquery.js:3119:1 jQuery.Callbacks/[email protected]://localhost:9000/bower_components/jquery/dist/jquery.js:3231:7 [email protected]://localhost:9000/bower_components/jquery/dist/jquery.js:3443:3 [email protected]://localhost:9000/bower_components/jquery/dist/jquery.js:3474:3

网友答案:

The reason people are using angular-ui-bootstrap is to avoid using jquery and bootstrap.js (which relies on jquery) and opt for an Angular solution. So my first attempt at getting this app working is to

  • Remove jquery.js, jquery-ui.js, and bootstrap.js out of the page.
  • Start from just plain Angular + Angular UI Bootstrap first. Try some examples from http://angular-ui.github.io/bootstrap/ if you want to get familiar with the directive usage.
  • Then, if you really need to, just add jquery back in later. But from my experience, you won't really need to if you stick to Angular way of coding. If you come from a strong jquery background and just start coding on Angular, I recommend you read this: http://stackoverflow.com/a/15012542/3788115
网友答案:
The component `angular-bootstrap` should have two javascript files: bower_components/angular-bootstrap/ui-bootstrap.js bower_components/angular-bootstrap/ui-bootstrap-tpls.js You only include the templates.

Edit: Corrected in the comments.

Use Chrome Canary for easier debugging, you will see the full error message instead of Uncaught object.

网友答案:

add ['ui.bootstrap'] on the main app.js

相关阅读:
Top