Show:

Methods

_groupValidatorOptions () Object private

Used by the options property to create a hash from the content that is grouped by validator type. If there is more than 1 of a type, it groups it into an array of option objects.

Returns:

Properties

attribute

String

The attribute that this collection belongs to

content

Ember.Array

A set of all validator Result objects for this specific attribute

error

Ember.ComputedProperty | Error

An alias to the first Error in the errors collection.

// Example
get(user, 'validations.error')
get(user, 'validations.attrs.username.error')

errors

Ember.ComputedProperty | Array

A collection of all Errors on the object in question. Each error object includes the error message and it's associated attribute name.

// Example
get(user, 'validations.errors')
get(user, 'validations.attrs.username.errors')

isAsync

Ember.ComputedProperty | Boolean

Will be true only if a validation returns a promise

// Examples
get(user, 'validations.isAsync')
get(user, 'validations.attrs.username.isAsync')


Default: false

isDirty

Ember.ComputedProperty | Boolean

Will be true is the attribute in question is not null or undefined. If the object being validated is an Ember Data Model and you have a defaultValue specified, then it will use that for comparison.

// Examples
// 'username' : DS.attr('string', { defaultValue: 'johndoe' })
get(user, 'validations.isDirty')
get(user, 'validations.attrs.username.isDirty')


Default: false

isInvalid

Ember.ComputedProperty | Boolean
// Examples
get(user, 'validations.isInvalid')
get(user, 'validations.attrs.username.isInvalid')

isTruelyValid

Ember.ComputedProperty | Boolean

Will be true only if isValid is true and isValidating is false

// Examples
get(user, 'validations.isTruelyValid')
get(user, 'validations.attrs.username.isTruelyValid')


Default: true

isValid

Ember.ComputedProperty | Boolean
// Examples
get(user, 'validations.isValid')
get(user, 'validations.attrs.username.isValid')


Default: true

isValidating

Ember.ComputedProperty | Boolean

This property is toggled only if there is an async validation

// Examples
get(user, 'validations.isValidating')
get(user, 'validations.attrs.username.isValidating')


Default: false

message

Ember.ComputedProperty | String

An alias to the first message in the messages collection.

// Example
get(user, 'validations.message')
get(user, 'validations.attrs.username.message')

messages

Ember.ComputedProperty | Array

A collection of all error messages on the object in question

// Examples
get(user, 'validations.messages')
get(user, 'validations.attrs.username.messages')

options

Ember.ComputedProperty | Object

All built options of the validators associated with the results in this collection grouped by validator type

// Given the following validators
{
  username: [
    validator('presence', true),
    validator('length', { max: 15 }),
    validator('format', { regex: /foo/ }),
    validator('format', { regex: /bar/ }),
  ]
}
get(user, 'validations.attrs.username.options')

The above will return the following

{
  'presence': { presence: true},
  'length': { max: 15 },
  'regex': [{ regex: /foo/ }, { regex: /bar/ }]
}