Ember Validatable (EM) is a simple and lightweight validation library for Ember.
Validations are added to a model by defining properties ending in either
AppUser = EmberModel;
Ember.Validatable also adds several properties to your model:
trueif all the validations on this model are successful.
isInvalid- the opposite of
errors- an Enumerable containing the contents of each validation's
errorproperty (should any be invalid).
Your validators should be a subclass of the
Ember.Validator class. As a minimum your validator should contain
isValid computed property (dependent on the
content property) which implements your logic for defining the
validity of the content.
Other properties available are:
content- the value of retrieving
target(ie the value to test for validity).
target- the model instance for which we are validating.
targetKey- the name of the property on
targetwhich we are validating.
message- "is invalid." by default.
error- by default this concatenates
message. The result of this will be placed in your models