mercredi 25 mai 2016

A belongsTo child model from parent model using get method is not of DS.Model type

I am trying to access a related(belongsTo) model from the parent model. the structure is as below

employee= DS.Model.extend({ serialNo: DS.attr('number'), name: DS.attr('number'), address: DS.belongsTo('employee/address') });

Now in a component i am receiving this top level employee model and there i am trying to access address model as below. this.get('employee').get('address')

but the address object i received is not of Model type, so i am not able to call any Model function on it. Surprisingly this.get('employee') returns a model object and i am able to call any Model function using it.

Thanks




Aucun commentaire:

Enregistrer un commentaire