samedi 7 janvier 2017

EmberJS doesn't populate camelCased attributes

EmberJS doesn't populate model attributes written in camelCase for some reason. I use JSONAPIAdapter (RESTAdapter is not an option). Here is my model:

import DS from 'ember-data';
export default DS.Model.extend({
    shortName: DS.attr('string'),
    fullName: DS.attr('string'),
    inn: DS.attr('string'),
    kpp: DS.attr('string'),
    checkingAccount: DS.attr('string'),
    correspodentAccount: DS.attr('string'),
    bik: DS.attr('string'),
});

My handlebars template:


        <tr class="companies-list__item">
            <td class="companies-list__property"></td>
            <td class="companies-list__property"></td>
            <td class="companies-list__property"></td>
            <td class="companies-list__property"></td>
            <td class="companies-list__property"></td>
            <td class="companies-list__property"></td>
        </tr>


Answer from server looks like this:

{
   type: 'company',
   id: 4,
   attributes: {
          shortName: 'Рога и копыта',
          fullName: 'ООО Рога и копыта',
          inn: '312312312',
          kpp: '767675572',
          checkingAccount: '3123145124',
          correspodentAccount: '6547598',
          bik: '76979356'
   },
 },

It does populate inn, kpp, bik, but doesn't use others. What's the problem?




Aucun commentaire:

Enregistrer un commentaire