ccdb-web/app/components/validated-field.js
2017-10-07 17:37:24 -07:00

14 lines
411 B
JavaScript

import Ember from 'ember';
const { Component, computed, get, isEmpty } = Ember;
export default Component.extend({
classNames: ['form-group'],
classNameBindings: ['isValid::has-error'],
isValid: computed('changeset.error', 'property', function() {
const changeset = this.get('changeset');
const property = this.get('property');
return isEmpty(get(changeset, `error.${property}`));
}),
});