Created
May 31, 2018 16:10
-
-
Save heat/a1df5fcb0e8bdadc1aaa7290713ac3eb to your computer and use it in GitHub Desktop.
component bs-switch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['btn'], | |
classNameBindings: ['classNameSwitch'], | |
classNameSwitch: Ember.computed('switch', function() { | |
return this.get('switch')? this.get('switchOn'): this.get('switchOff'); | |
}), | |
switchOff: 'text-danger', | |
switchOn: 'text-success', | |
switch: null, | |
click(event) { | |
this.get('action')(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment