Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit b0c1dac

Browse files
author
Kent C. Dodds
committed
Closes #18
1 parent 88681be commit b0c1dac

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 4.0.9
2+
3+
- Allowing descriptions on all types
4+
15
# 4.0.8
26

37
- Fixing issue #17 with form control not getting set on multiCheckbox and radio types.

src/run/description.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,21 @@ export default ngModule => {
33

44
function addDescriptionManipulator(formlyConfig) {
55
formlyConfig.templateManipulators.preWrapper.push(function ariaDescribedBy(template, options, scope) {
6-
if (angular.isDefined(options.templateOptions.description) &&
7-
options.type !== 'radio' && options.type !== 'checkbox') {
6+
if (angular.isDefined(options.templateOptions.description)) {
87
var el = document.createElement('div');
98
el.appendChild(angular.element(template)[0]);
9+
el.appendChild(angular.element(
10+
'<p id="' + scope.id + '_description"' +
11+
'class="help-block"' +
12+
'ng-if="to.description">' +
13+
'{{to.description}}' +
14+
'</p>'
15+
)[0]);
1016
var modelEls = angular.element(el.querySelectorAll('[ng-model]'));
1117
if (modelEls) {
12-
el.appendChild(angular.element(
13-
'<p id="' + scope.id + '_description"' +
14-
'class="help-block"' +
15-
'ng-if="to.description">' +
16-
'{{to.description}}' +
17-
'</p>'
18-
)[0]);
1918
modelEls.attr('aria-describedby', scope.id + '_description');
20-
return el.innerHTML;
21-
} else {
22-
return template;
2319
}
20+
return el.innerHTML;
2421
} else {
2522
return template;
2623
}

0 commit comments

Comments
 (0)