dev-master
9999999-dev http://angular-ui.github.io/bootstrap/Native AngularJS (Angular) directives for Twitter's Bootstrap
MIT
The Requires
Native AngularJS (Angular) directives for Twitter's Bootstrap
Do you want to see directives in action? Visit http://angular-ui.github.io/bootstrap/!, (*2)
Installation is easy as angular-ui-bootstrap has minimal dependencies - only the AngularJS and Bootstrap's CSS are required.
After downloading dependencies (or better yet, referencing them from your favourite CDN) you need to download build version of this project. All the files and their purposes are described here:
https://github.com/angular-ui/bootstrap/tree/gh-pages#build-files
Don't worry, if you are not sure which file to take, opt for ui-bootstrap-tpls-[version].min.js
., (*3)
When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the ui.bootstrap
AngularJS module:, (*4)
angular.module('myModule', ['ui.bootstrap']);
Project files are also available through your favourite package manager:
* Bower: bower install angular-bootstrap
* NuGet: https://nuget.org/packages/Angular.UI.Bootstrap/, (*5)
Directives from this repository are automatically tested with the following browsers: * Chrome (stable and canary channel) * Firefox * IE 9 and 10 * Opera * Safari, (*6)
Modern mobile browsers should work without problems., (*7)
IE 8 is not officially supported at the moment. This project is run by volunteers and with the current number of commiters we are not in the position to guarantee IE8 support. If you need support for IE8 we would welcome a contributor who would like to take care about IE8. Alternatively you could sponsor this project to guarantee IE8 support., (*8)
We believe that most of the directives would work OK after: * including relevant shims (for ES5 we recommend https://github.com/kriskowal/es5-shim) * taking care of the steps described in http://docs.angularjs.org/guide/ie, (*9)
We are simply not regularly testing against IE8., (*10)
We are aiming at providing a set of AngularJS directives based on Bootstrap's markup and CSS. The goal is to provide native AngularJS directives without any dependency on jQuery or Bootstrap's JavaScript. It is often better to rewrite an existing JavaScript code and create a new, pure AngularJS directive. Most of the time the resulting directive is smaller as compared to the original JavaScript code size and better integrated into the AngularJS ecosystem., (*11)
All the directives in this repository should have their markup externalized as templates (loaded via templateUrl
). In practice it means that you can customize directive's markup at will. One could even imagine providing a non-Bootstrap version of the templates!, (*12)
Each directive has its own AngularJS module without any dependencies on other modules or third-party JavaScript code. In practice it means that you can just grab the code for the directives you need and you are not obliged to drag the whole repository., (*13)
Directives should work. All the time and in all browsers. This is why all the directives have a comprehensive suite of unit tests. All the automated tests are executed on each checkin in several browsers: Chrome, ChromeCanary, Firefox, Opera, Safari, IE9. In fact we are fortunate enough to benefit from the same testing infrastructure as AngularJS!, (*14)
If you are having problems making some directives work, there are several ways to get help:, (*15)
#angularjs
channel at the freenode
network). Use this webchat or your own IRC client.Project's issue on GitHub should be used discuss bugs and features., (*16)
We are always looking for the quality contributions! Please check the CONTRIBUTING.md for the contribution guidelines., (*17)
npm install -g grunt-cli karma
npm install
while current directory is bootstrap repogrunt
- this will run lint
, test
, and concat
targetsgrunt html2js
then grunt build:module1:module2...:moduleN
You can generate a custom build, containing only needed modules, from the project's homepage. Alternatively you can run local Grunt build from the command line and list needed modules as shown below:, (*18)
grunt build:modal:tabs:alert:popover:dropdownToggle:buttons:progressbar
Check the Grunt build file for other tasks that are defined for this project., (*19)
grunt watch
This will start Karma server and will continuously watch files in the project, executing tests upon every change., (*20)
Add the --coverage
option (e.g. grunt test --coverage
, grunt watch --coverage
) to see reports on the test coverage. These coverage reports are found in the coverage folder., (*21)
As mentioned directives from this repository have all the markup externalized in templates. You might want to customize default templates to match your desired look & feel, add new functionality etc., (*22)
The easiest way to override an individual template is to use the <script>
directive:, (*23)
<script id="template/alert/alert.html" type="text/ng-template"> <div class='alert' ng-class='type && "alert-" + type'> <button ng-show='closeable' type='button' class='close' ng-click='close()'>Close</button> <div ng-transclude></div> </div> </script>
If you want to override more templates it makes sense to store them as individual files and feed the $templateCache
from those partials.
For people using Grunt as the build tool it can be easily done using the grunt-html2js
plugin. You can also configure your own template url.
Let's have a look:, (*24)
Your own template url is views/partials/ui-bootstrap-tpls/alert/alert.html
., (*25)
Add "html2js" task to your Gruntfile, (*26)
html2js: { options: { base: '.', module: 'ui-templates', rename: function (modulePath) { var moduleName = modulePath.replace('app/views/partials/ui-bootstrap-tpls/', '').replace('.html', ''); return 'template' + '/' + moduleName + '.html'; } }, main: { src: ['app/views/partials/ui-bootstrap-tpls/**/*.html'], dest: '.tmp/ui-templates.js' } }
Make sure to load your template.js file
<script src="/ui-templates.js"></script>
, (*27)
Inject the ui-templates
module in your app.js
, (*28)
angular.module('myApp', [ 'ui.bootstrap', 'ui-templates' ]);
Then it will work fine!, (*29)
For more information visit: https://github.com/karlgoldstein/grunt-html2js, (*30)
package.json
chore(release): [version number]
git push --tags
)gh-pages
branch: git checkout gh-pages
chore(release): [version number]
main branch
and modify package.json
to bump up version for the next iterationchore(release): starting [version number]
) and pushWell done! (If you don't like repeating yourself open a PR with a grunt task taking care of the above!), (*31)
Native AngularJS (Angular) directives for Twitter's Bootstrap
MIT