From 6f86754646924d26e645901570b556bc6311930d Mon Sep 17 00:00:00 2001 From: Snow Date: Thu, 14 Feb 2019 12:00:59 +1100 Subject: [PATCH] Trigger actions from md-select. --- addon/components/md-select.js | 14 ++++++++++++++ addon/templates/components/md-select.hbs | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addon/components/md-select.js b/addon/components/md-select.js index 116c7fa0..e8fb1644 100644 --- a/addon/components/md-select.js +++ b/addon/components/md-select.js @@ -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() { diff --git a/addon/templates/components/md-select.hbs b/addon/templates/components/md-select.hbs index 17c2d764..c2506bc0 100644 --- a/addon/templates/components/md-select.hbs +++ b/addon/templates/components/md-select.hbs @@ -1,6 +1,6 @@ -