Skip to content

Commit

Permalink
fix(select input, readme): Handle object options in select input
Browse files Browse the repository at this point in the history
You can pass an object with key:value pairs for a select options instead only arrays. You also need

formly-js#107
  • Loading branch information
eliagentili committed Nov 27, 2016
1 parent bf39c6f commit 2f4e76d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ _Example radio field_
>The select field allows selection via dropdown using the select element.
##### options (array, required)
>`options` is an array of options for the select form field to display. Each option should be an object with a `name`(string). You may optionally add a `group` to some or all of your options.
>`options` it can be an array or an object:
- an array of options for the select form field to display. Each option should be an object with a `name`(string). You may optionally add a `group` to some or all of your options.
- an object with key an value pairs used in combination with ngOptions ([Example](http://jsbin.com/gikiji/3/edit?js,output)).

##### labelProp (string, optional)
>`labelProp` is what is used for what is shown to the user. Defaults to `name`
Expand Down
2 changes: 1 addition & 1 deletion src/types/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default ngModule => {
},
apiCheck: check => ({
templateOptions: {
options: check.arrayOf(check.object),
options: check.oneOfType([check.arrayOf(check.object), check.objectOf(check.string)]),
optionsAttr: check.string.optional,
labelProp: check.string.optional,
valueProp: check.string.optional,
Expand Down

0 comments on commit 2f4e76d

Please sign in to comment.