diff --git a/src/pagination/docs/readme.md b/src/pagination/docs/readme.md
index 0b55b66695..8f8a50dea5 100644
--- a/src/pagination/docs/readme.md
+++ b/src/pagination/docs/readme.md
@@ -81,3 +81,7 @@ For `ng-model`, `total-items`, `items-per-page` and `num-pages` see pagination s
* `next-text`
_(Default: 'Next ยป')_ :
Text for Next button.
+
+ * `template-url`
+ _(Default: 'template/pagination/pager.html') :
+ Override the template for the component with a custom provided template
diff --git a/src/pagination/pagination.js b/src/pagination/pagination.js
index 64086b7ab0..82732ac9d1 100644
--- a/src/pagination/pagination.js
+++ b/src/pagination/pagination.js
@@ -209,7 +209,10 @@ angular.module('ui.bootstrap.pagination', [])
},
require: ['pager', '?ngModel'],
controller: 'PaginationController',
- templateUrl: 'template/pagination/pager.html',
+ controllerAs: 'pagination',
+ templateUrl: function(element, attrs) {
+ return attrs.templateUrl || 'template/pagination/pager.html';
+ },
replace: true,
link: function(scope, element, attrs, ctrls) {
var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1];
diff --git a/src/pagination/test/pager.spec.js b/src/pagination/test/pager.spec.js
index 370ef073e0..76cbf8ad51 100644
--- a/src/pagination/test/pager.spec.js
+++ b/src/pagination/test/pager.spec.js
@@ -1,13 +1,14 @@
describe('pager directive', function () {
- var $compile, $rootScope, $document, element;
+ var $compile, $rootScope, $document, $templateCache, element;
beforeEach(module('ui.bootstrap.pagination'));
beforeEach(module('template/pagination/pager.html'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _$document_) {
+ beforeEach(inject(function(_$compile_, _$rootScope_, _$document_, _$templateCache_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
$rootScope.total = 47; // 5 pages
$rootScope.currentPage = 3;
$document = _$document_;
+ $templateCache = _$templateCache_;
element = $compile('