Reputation: 137
I try to use the accordion directive with my own template. I use the following:
<accordion close-others="1">
<accordion-group heading="First" is-open="1" template-url="template/accordion/accordion-mytemplate.html">
First
</accordion-group>
<accordion-group heading="Second" template-url="template/accordion/accordion-mytemplate.html">
Second
</accordion-group>
</accordion>
with template defined inside JavaScript file:
angular.module("template/accordion/accordion-mytemplate.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/accordion/accordion-mytemplate.html",
"<div class=\"panel panel-default\">\n" +
"<div class=\"panel-heading\">\n" +
"<h1 class=\"panel-title\">\n" +
"TEST: <a href=\"javascript:void(0)\" tabindex=\"0\" class=\"accordion-toggle\" ng-click=\"toggleOpen()\" accordion-transclude=\"heading\"><span ng-class=\"{'text-muted': isDisabled}\">{{heading}}</span></a>\n" +
"</h1>\n" +
"</div>\n" +
"<div class=\"panel-collapse collapse\" collapse=\"!isOpen\">\n" +
" <div class=\"panel-body\" ng-transclude></div>\n" +
"</div>\n" +
"</div>\n" +
"");
}]);
and unfortunately it doesn't work for both work when I use $templateCache or I have template saved directly in template/accordion/accordion-mytemplate.html file (this way is preffered by me).
Can anybody describe me how to use ui.bootstrap.accordion with customized template and why template-url attribute doesn't work?
Upvotes: 4
Views: 3012
Reputation: 4062
Try upgrading to the latest version of angular-bootstrap
. Older versions did not support the template-url
attribute.
Upvotes: 2