DS.JSONSerializer#keyForAttribute()

keyForAttribute (key, method) String

Defined in addon/serializers/json.js:1433

keyForAttribute can be used to define rules for how to convert an attribute name in your model to a key in your JSON.

Example

app/serializers/application.js
import DS from 'ember-data';

export default DS.RESTSerializer.extend({
  keyForAttribute: function(attr, method) {
    return Ember.String.underscore(attr).toUpperCase();
  }
});

Parameters:

key String
method String

Returns:

String
normalized key
doc_EmberJs
2016-11-30 16:49:50
Comments
Leave a Comment

Please login to continue.