Skip to content

Commit 3255b40

Browse files
committed
Merge branch 'DennisHalmstad-patch-1' into development
2 parents 8098226 + 14ae549 commit 3255b40

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

docs/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,22 @@ As an object:
718718
}
719719
```
720720
721+
The *select* can also take an optional `group` property in its `titleMap` that adds `<optgroup>`
722+
element to the select.
723+
724+
```javascript
725+
{
726+
type: "select",
727+
titleMap: [
728+
{ value: "yes", name: "Yes I do", group: "Boolean" },
729+
{ value: "no", name: "Hell no" , group: "Boolean" },
730+
{ value: "no", name: "File Not Found", group: "Other" },
731+
]
732+
}
733+
```
734+
735+
736+
721737
### actions
722738
723739
*actions* behaves the same as fieldset, but can only handle buttons as chidren.

src/directives/decorators/bootstrap/select.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sf-changed="form"
1010
class="form-control {{form.fieldHtmlClass}}"
1111
schema-validate="form"
12-
ng-options="item.value as item.name for item in form.titleMap"
12+
ng-options="item.value as item.name group by item.group for item in form.titleMap"
1313
name="{{form.key.slice(-1)[0]}}">
1414
</select>
1515
<div class="help-block" sf-message="form.description"></div>

src/directives/message.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ angular.module('schemaForm').directive('sfMessage',
5656
update();
5757

5858
scope.$watchCollection('ngModel.$error', function() {
59+
if (scope.ngModel) {
5960
update(scope.ngModel.$valid);
61+
}
6062
});
6163

6264
}

0 commit comments

Comments
 (0)