How to use an accordion group with the template-url attribute

I am trying to use the accordion directive with my own template. I am using 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 a template defined inside a 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 does not work for both jobs when I use $ templateCache or I have a template that is saved directly in the template / accordion / accordion-mytemplate.html file (this method is used by me).

Can someone please tell me how to use ui.bootstrap.accordion with a custom template and why the template-url attribute does not work?

+4
source share
1 answer

angular-bootstrap. template-url.

+2

All Articles