DS.Errors#has()

has (attribute) Boolean

Defined in addon/-private/system/model/errors.js:405

Checks if there is error messages for the given attribute.

app/routes/user/edit.js
import Ember from 'ember';

export default Ember.Route.extend({
  actions: {
    save: function(user) {
       if (user.get('errors').has('email')) {
         return alert('Please update your email before attempting to save.');
       }
       user.save();
     }
  }
});

Parameters:

attribute String

Returns:

Boolean
true if there some errors on given attribute
doc_EmberJs
2016-11-30 16:49:37
Comments
Leave a Comment

Please login to continue.