简体   繁体   中英

Should I used 'ui' or 'ui.boostrap' when including angular-ui and why does angular-ui have a build sub directory?

I'm using yeoman . According to the readme under angular-ui/build/README.md

The repository comes with the modules pre-built and compressed into the build/ directory.

Usage is documented as:

angular.module('myApp', ['ui']);

and

You do not need to build the project to use it - see above [...]

In order to start using angular-ui, I changed the declaration of my angular-js module to include 'ui'

var app = angular.module('MyApp', [
    'ngCookies',
    'ngResource',
    'ngSanitize',
    'ngRoute',
    'ui'
]);

However the UI Bootstrap documentation states installation is achieved with:

angular.module('myModule', ['ui.bootstrap']);

Question #1: What's the difference between using only ui and ui.bootstrap ?

I then included the following js file manually into my .html file (note the build directory in the path as this relates to question 3):

<script src="bower_components/angular-ui/build/angular-ui.js"></script>

However all other angular components are included automatically into my .html file as part of the build process:

Question #2 : How do I use angular-ui such that it too is added as part of the build process?

Question #3 : Why does angular-ui have .js files in a build sub-directory while other angular components do not?

Answer # 1: The difference is that Angular-ui is a combination of several packages of the angular-ui project specificly all (or almost all) the UI-Utils and UI-Modules, and the UI-Bootstrap is another part of the project that includes several bootstrap components writen in angular way and is not included in the Angular-UI Bundle pack ... here for more info and see all the different packages of the project Angular UI github

Answer # 2 As already you did just including the 'ui' dependency into the dependecys array of your main module, howerver it will not include the ui-bootstrap as i mention above

Answer # 3 Those files are as you can see in the link of the main proyect of angular-ui are the modules and utils as separate components so you can delete them from your project and only include the distriburion files or you can use them separetly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM