Function
eachTransformedAttribute (callback, binding) public
Module:
@ember-data/model
Defined in ../model/addon/-private/model.js:2015
- callback
- Function
- The callback to execute
- binding
- Object
- the value to which the callback's `this` should be bound
Iterates through the transformedAttributes of the model, calling the passed function on each attribute. Note the callback will not be called for any attributes that do not have an transformation type.
The callback method you provide should have the following signature (all parameters are optional):
1 |
function(name, type); |
name
the name of the current property in the iterationtype
a string containing the name of the type of transformed applied to the attribute
Note that in addition to a callback, you can also pass an optional target
object that will be set as this
on the context.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import Model, { attr } from '@ember-data/model'; let Person = Model.extend({ firstName: attr(), lastName: attr('string'), birthday: attr('date') }); Person.eachTransformedAttribute(function(name, type) { console.log(name, type); }); // prints: // lastName string // birthday date |