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

How to get belongsTo object

$
0
0

@wowember wrote:

How do you interact with a model’s belongsTo relationships?

If I have a model:

model-with-references.js

export default DS.Model.extend({
  referenced_thing: DS.belongsTo('thing'),
  referenced_thing_async: DS.belongsTo('thing_async', {async: true})
});

Then in a route or a controller, how do I do:

let referenced_thing =
    this.get('modelWithReferences')
            .howToGetTheReferencedThing()

let referenced_thingAsync = 
    this.get('modelWithReferences')
            .howToGetTheReferencedThingAsync()

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles