Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

TypeError: Cannot read property 'type' of undefined

$
0
0

@Frank wrote:

I get this error TypeError: Cannot read property 'type' of undefined from a this.store.query('record-type', { id : someId } call. I get a 200 reponse from the backend with the same JSON format that I get elsewhere in my app, like this

{
"id": int,
"attr1": "string",
"attr2: "string",
etc.
}

but I can’t access the object in ember. Reading a bit around it seems this might be related to a serializer issue, but I a little bit lost here. I don’t understand why in that specific case I would need to serialize whereas I don’t need to do it with the other models in my app, nor exactly how serializer works, even after reading the doc on it.

Here is my model

import DS from 'ember-data';
const { Model, attr, belongsTo } = DS;

export default Model.extend({
  autoClose: attr('boolean'),
  capaRequired: attr('boolean'),
  carNumber: attr('string'),
  conclusion: attr('string'),
  dispositionId: attr('number'),
  dispositionName: attr('string'),
  impactInfo: attr('string'),
  instructions: attr('string'),
  issueType: belongsTo('issue-type'),
  needsConfirmation: attr('boolean'),
  priority: attr('string')
});

Anyone has any idea what I am doing wrong?

Thanks!

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles