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

Possible to get a computed property from DS.Snapshot?

$
0
0

@Baumer wrote:

I am using the most up to date stable versions Ember/Ember Data (2.3.1)

Is it possible to get computed property values out of an Ember Object that is exposed through the DS.Snapshot Object? I do not see an easy way to get these values, and right now I am duplicating a lot of logic to extract these values.

For example, if I have an Ember Object that looks like:

var FooModel = DS.Model.extend({
  firstName: DS.attr('string'),
  lastName: DS.attr('string'),
  fullName: function() {
    return `${this.get('firstName') ${this.get('lastName')};
  }.property('firstName', 'lastName')
});

Through the DS.Snapshot object that is exposed, I am able to get firstName and lastName through the snapshots attr method, but I do not see a way to get the fullName computed property. I have googled this and haven't had much luck. Any insight would be helpful, thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles