From e1356c48625e4820fb8014ffb9d6154536d47d1f Mon Sep 17 00:00:00 2001 From: Sam Julien Date: Tue, 2 Feb 2016 13:39:34 -0800 Subject: [PATCH 1/2] feat(accordion): replace span with tag in uibAccordionTransclude --- src/accordion/accordion.js | 5 +++-- template/accordion/accordion-group.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/accordion/accordion.js b/src/accordion/accordion.js index 002daedca9..f0b4748799 100644 --- a/src/accordion/accordion.js +++ b/src/accordion/accordion.js @@ -123,8 +123,9 @@ angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) link: function(scope, element, attrs, controller) { scope.$watch(function() { return controller[attrs.uibAccordionTransclude]; }, function(heading) { if (heading) { - element.find('span').html(''); - element.find('span').append(heading); + var elem = angular.element(element[0].querySelector('[uib-accordion-header]')); + elem.html(''); + elem.append(heading); } }); } diff --git a/template/accordion/accordion-group.html b/template/accordion/accordion-group.html index 88c05f4eda..728c674c1c 100644 --- a/template/accordion/accordion-group.html +++ b/template/accordion/accordion-group.html @@ -1,7 +1,7 @@
From ae10c7184490ed2b29008216f55f545babde9252 Mon Sep 17 00:00:00 2001 From: Sam Julien Date: Wed, 3 Feb 2016 15:05:30 -0800 Subject: [PATCH 2/2] docs(accordion): add blurb about new header tag --- src/accordion/docs/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/accordion/docs/readme.md b/src/accordion/docs/readme.md index 10e9c2986e..e176d8fde2 100644 --- a/src/accordion/docs/readme.md +++ b/src/accordion/docs/readme.md @@ -44,6 +44,8 @@ The body of each accordion group is transcluded into the body of the collapsible Instead of the `heading` attribute on the `uib-accordion-group`, you can use an `uib-accordion-heading` element inside a group that will be used as the group's header. +If you're using a custom template for the `uib-accordion-group`, you'll need to have an element for the heading to be transcluded into using `uib-accordion-header` (e.g. `
`). + ### Known issues To use clickable elements within the accordion, you have override the accordion-group template to use div elements instead of anchor elements, and add `cursor: pointer` in your CSS. This is due to browsers interpreting anchor elements as the target of any click event, which triggers routing when certain elements such as buttons are nested inside the anchor element.