diff --git a/src/accordion/accordion.js b/src/accordion/accordion.js index 348bd79f9c..b705701c97 100644 --- a/src/accordion/accordion.js +++ b/src/accordion/accordion.js @@ -49,7 +49,9 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) controller:'AccordionController', transclude: true, replace: false, - templateUrl: 'template/accordion/accordion.html' + templateUrl: function(element, attrs) { + return attrs.templateUrl || 'template/accordion/accordion.html'; + } }; }) @@ -60,7 +62,9 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) restrict:'EA', transclude:true, // It transcludes the contents of the directive into the template replace: true, // The element containing the directive will be replaced with the template - templateUrl:'template/accordion/accordion-group.html', + templateUrl: function(element, attrs) { + return attrs.templateUrl || 'template/accordion/accordion-group.html'; + }, scope: { heading: '@', // Interpolate the heading attribute onto this scope isOpen: '=?', diff --git a/src/accordion/docs/readme.md b/src/accordion/docs/readme.md index 1a67460cbe..5af801726c 100644 --- a/src/accordion/docs/readme.md +++ b/src/accordion/docs/readme.md @@ -8,3 +8,10 @@ The body of each accordion group is transcluded in to the body of the collapsibl * `is-open` (Defaults: false) : Whether accordion group is open or closed. + * `template-url` (Defaults: `template/accordion/accordion.html`) : + Add ability to override the template url used + +### Accordion Group Settings ### + + * `template-url` (Defaults: `template/accordion/accordion-group.html`) : + Add ability to override the template url used diff --git a/src/accordion/test/accordion.spec.js b/src/accordion/test/accordion.spec.js index 0a5c4134c6..0436655da8 100644 --- a/src/accordion/test/accordion.spec.js +++ b/src/accordion/test/accordion.spec.js @@ -102,6 +102,23 @@ describe('accordion', function () { }); }); + describe('accordion', function () { + var scope, $compile, element; + + beforeEach(inject(function($rootScope, _$compile_) { + scope = $rootScope; + $compile = _$compile_; + })); + + it('should allow custom templates', inject(function ($templateCache) { + $templateCache.put('foo/bar.html', '