Skip to content

Instantly share code, notes, and snippets.

@zshamrock
Last active December 11, 2015 21:29
Show Gist options
  • Save zshamrock/4663214 to your computer and use it in GitHub Desktop.
Save zshamrock/4663214 to your computer and use it in GitHub Desktop.
AngularJS UI Bootstrap templatePrefix
angular.module("ui.bootstrap", ["ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.carousel","ui.bootstrap.collapse","ui.bootstrap.dialog","ui.bootstrap.dropdownToggle","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tabs","ui.bootstrap.tooltip","ui.bootstrap.transition","ui.bootstrap.config"]);
angular.module("ui.bootstrap.config", []).value("ui.bootstrap.config", {templatePrefix: "template"});
...
angular.module('ui.bootstrap.pagination', ["ui.bootstrap.config"])
.directive('pagination', ["ui.bootstrap.config", function(uiBootstrapConfig) {
return {
restrict: 'EA',
scope: {
numPages: '=',
currentPage: '=',
maxSize: '=',
onSelectPage: '&'
},
templateUrl: uiBootstrapConfig.templatePrefix + "/pagination/pagination.html",
replace: true,
...
// In my app (simplified), instead of <applicationContext> I use real application context, of course:
angular.module("app", [
...
"ui",
"ui.bootstrap"
])
.value("ui.bootstrap.config", {templatePrefix: "/<applicationContext>/template"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment