Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions addon/components/md-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ export default MaterializeInputField.extend({
// jscs: enable
},

actions: {
optionSelected(e) {
const target = e.target;
if (!this.get('isDisabled')) {
if (this.get('action')) {
this.sendAction('action', target.value);
}
else {
this.set('value', target.value)
}
}
}
},

// TODO: this could be converted to a computed property, returning a string
// that is bound to the class attribute of the inputSelector
errorsDidChange: observer('errors', function() {
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/md-select.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<label id="{{id}}" class="active">{{label}}</label>

<select onchange={{action (mut value) value="target.value"}}
<select onchange={{action 'optionSelected'}}
class="{{if validate 'validate'}} {{if errors 'invalid' 'valid'}}"
disabled={{if disabled "true"}}>
{{#if prompt}}
Expand Down