Last active
February 29, 2016 00:54
-
-
Save ptgamr/1f8338dbb7163db90dba to your computer and use it in GitHub Desktop.
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({ | |
field: null, | |
isFieldDirty: Ember.computed('field.value', { | |
get() { | |
return this.get('field.value') !== this.get('field.originalValue') | |
} | |
}) | |
actions: { | |
updateValue(newValue) { | |
this.get('onFieldValueChange')(newValue); | |
} | |
} | |
}); |
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({ | |
fields: Ember.computed({ | |
get() { | |
return [ | |
{name: 'id', value: 'id', originalValue: 'id'}, | |
{name: 'username', value: 'username', originalValue: 'username'}, | |
] | |
} | |
}) | |
actions: { | |
reset() { | |
//reset all the fields to make value === originalValue | |
} | |
} | |
}); | |
Raw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment