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

Commit bbeba7e

Browse files
author
Kent C. Dodds
committed
Fixes bug in last release where you couldn't actually override anything.
1 parent 8eb5de7 commit bbeba7e

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/types/select.html

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/types/select.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
export default ngModule => {
22
ngModule.config(addSelectType);
33

4+
const template = `<select class="form-control" ng-model="model[options.key]"></select>`;
5+
46
function addSelectType(formlyConfigProvider, formlyBootstrapApiCheck) {
57
const c = formlyBootstrapApiCheck;
68
formlyConfigProvider.setType({
79
name: 'select',
8-
template: require('./select.html'),
10+
template,
911
wrapper: ['bootstrapLabel', 'bootstrapHasError'],
1012
defaultOptions(options) {
11-
if (options.templateOptions.ngOptions) {
12-
return {
13-
ngModelAttrs: {
14-
[options.templateOptions.ngOptions]: {
15-
value: 'ng-options'
16-
}
13+
/* jshint maxlen:195 */
14+
let ngOptions = options.templateOptions.ngOptions || `option[to.valueProp || 'value'] as option[to.labelProp || 'name'] group by option[to.groupProp || 'group'] for option in to.options`;
15+
return {
16+
ngModelAttrs: {
17+
[ngOptions]: {
18+
value: 'ng-options'
1719
}
18-
};
19-
}
20+
}
21+
};
2022
},
2123
apiCheck: {
2224
templateOptions: c.shape({

0 commit comments

Comments
 (0)