Class: Embedded

.fields. Embedded


new Embedded(name, type, schema, value, $endpoint, service, $states, relationName)

Apy Embedded Field

Parameters:
Name Type Description
name string

Field name

type string

Field type

schema Object

Field schema

value Object

Field value

$endpoint string

Field endpoint

service Object

Reference to Service instance

$states Object

Field inner state holder instance

relationName string

(optional) Field relation name

Extends

Methods


<static> cleanedData()

Get cleaned data

Returns:

The Embedded Resource ID

Type
string

<static> cloneValue(value)

Embedded field - clone a value

Parameters:
Name Type Description
value Object

A JSON object

Returns:

cloned value

Type
Object

<static> hasUpdated()

Return true if original value has changed from current one. In other words, if inner _id (Eve metadata) property is different from the original one.

Returns:

Is the Embedded field updated ?

Type
boolean

<static> reset()

Reset inner value to its original value ($memo) if different Reset inner components array.

Returns:

this

Type
apy.components.fields.Embedded

<static> selfCommit()

Embedded Field Method to definitely update itself.

Reset $memo to the current value of cleanedData() method. Add current metadata properties as well

Returns:

this

Type
apy.components.fields.Embedded

<static> selfUpdate(update, commit)

Embedded Field Method to update itself.

Parameters:
Name Type Description
update Object

The update payload

commit boolean

If true, selfCommit method is invoked

Returns:

this

Type
apy.components.fields.Embedded

<static> setValue(value)

Set a given value to attribute $memo, using cloneValue method.

Load itself with given value, formatting it to an Object

Parameters:
Name Type Description
value string | Object

Either a string representing Resource ID or its representation as a JSON object

Returns:

this

Type
apy.components.fields.Embedded

<static> toString()

Embedded Field String representation

Returns:

Embedded Field string representation

Type
string

<static> validate()

Override parent property to specified validation behaviour. If no ID found

Throws:

When validation fails

Type
apy.errors.Error