import Ember from 'ember';

const { Mixin } = Ember;

export default Mixin.create({

  init(){
    this._super(...arguments);
    this.set('showErrorsFor', []);
  },
  showErrorsFor: [],
  actions: {
    addErrorDisplayFor(field){
      this.get('showErrorsFor').pushObject(field);
    },
    removeErrorDisplayFor(field){
      this.get('showErrorsFor').removeObject(field);
    },
  }
});

import Ember from 'ember';

const { Mixin } = Ember;

export default Mixin.create({
  didReceiveAttrs(){
    this._super(...arguments);
    this.set('showErrorsFor', []);
  },
  showErrorsFor: [],
  actions: {
    addErrorDisplayFor(field){
      this.get('showErrorsFor').pushObject(field);
    },
    removeErrorDisplayFor(field){
      this.get('showErrorsFor').removeObject(field);
    },
  }
});

Reset validation errors with each render
Reset validation errors with each render

If we do this in init then the errors don’t get cleared up when new
data is passed in.
