angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.3k stars 6.74k forks source link

Can't load modules separately. #6645

Closed IvanProdaiko94 closed 6 years ago

IvanProdaiko94 commented 6 years ago

Bug description:

I tried use webpack modules loading from angular-ui-bootstrap.

// bootstrap.js
export const bootstrap = [
    // require('angular-ui-bootstrap'),
    require('angular-ui-bootstrap/src/collapse'),
    require('angular-ui-bootstrap/src/progressbar'),
    require('angular-ui-bootstrap/src/datepickerPopup/index-nocss'),
    require('angular-ui-bootstrap/src/modal/index-nocss'),
    require('angular-ui-bootstrap/src/dropdown/index-nocss'),
    require('angular-ui-bootstrap/src/tooltip/index-nocss'),
    require('angular-ui-bootstrap/src/typeahead/index-nocss'),
    require('angular-ui-bootstrap/src/carousel/index-nocss')
];
// main.js
import { bootstrap } from './bootstrap';
angular.module('myModule', bootstrap);

Unfortunately, this is not working. I checked bundle and there are both templates cache and the code for components, so this is not a problem with bundling. Also, I guessed that it could be a problem with namespaces. So I tried to do it like that:

// main.js
import { bootstrap } from './bootstrap';
angular.module('ui.bootstrap.module', bootstrap);
angular.module('ui.bootstrap', ['ui.bootstrap.module']);
angular.module('myModule', ['ui.bootstrap');

I debugged code and the directives are actually linked to the elements, but when I expect them to start work as they should, that don't. After all I decided to require all of the bundle at once.

// bootstrap.js
export const bootstrap = [ require('angular-ui-bootstrap') ]

And all of the functionality started working as it should.

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.8

UIBS: 2.5.0