Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

docs: add grunt-html2js for template url customization #1188

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,45 @@ Project files are also available through your favourite package manager:
* **Bower**: `bower install angular-bootstrap`
* **NuGet**: https://nuget.org/packages/Angular.UI.Bootstrap/

### Configure your template url
You can easily configure your own template url by using Grunt plugin `grunt-html2js`.
Let's have a look:

Your own template url is `views/partials/ui-bootstrap-tpls/alert/alert.html`.

Add "html2js" task to your Gruntfile
```
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>`

Inject the `ui-templates` module in your `app.js`
```
angular.module('myApp', [
'ui.bootstrap',
'ui-templates'
]);
```

Then it will work fine!

More information, visit: https://github.com/karlgoldstein/grunt-html2js

## Supported browsers

Directives from this repository are automatically tested with the following browsers:
Expand Down