remove (attribute) deprecated
Removes all error messages from the given attribute and sends becameValid
event to the record if there no more errors left.
Example:
app/models/user.js
1 2 3 4 5 6 7 | import DS from 'ember-data' ; export default DS.Model.extend({ email: DS.attr( 'string' ), twoFactorAuth: DS.attr( 'boolean' ), phone: DS.attr( 'string' ) }); |
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( 'twoFactorAuth' )) { user.get( 'errors' ).remove( 'phone' ); } user.save(); } } }); |
Parameters:
-
attribute
String
Please login to continue.