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
1
2
3
4
5
6
7
8
9
10
11
12
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.