ember.js - Ember Data with large JSON name/value pairs -


I have a JSON file that has added 30 attributes / values ​​that are likely to increase in size. As part of amber data, I understand that there is a need to define each feature.

  App.Users = DS.Model.extend ({firstName: DS.attr () lastName: DS.attr () JobNumber: DS.attr () ...  < / Pre> 

I was expecting

  App.Users = DS.Model.extend ()  

.. will work but unfortunately No.

Is there a way to avoid defining a large number of Jasmine properties?

Just define the features that you need in your template, or you'll be modified.

In that case all you need is The attributes, you have to list them all in the model, the reason is that the serializer uses this value to analyze the data, such as date field or any number.

It will be able to reach around by creating a custom adapter that takes everything as a string attribute in json. But I do not recommend it. It is better to be clear in the area of ​​your model .


Comments