jeudi 17 septembre 2015

Ember binding with dynamic computed alias

I have a component that is provided each record ('data') of a model, along with 'meta' information that defines the attribute of the record to use, and renders it to a table. Within the component I'm trying to bind the underlying record attribute to each UI element {{tdVal}}:

tdVal : function(){

    return Ember.computed.alias('data.' + this.get('meta').get('field'));

}.property()

Unfortunately this just renders [object object] in the UI. For comparison the following renders all of the items correctly, but obviously does not bind:

tdVal : function(){

    return this.get('data').get(this.get('details').get('field'));

}.property()

Am I going about this in completely the wrong way? Any help would be very much appreciated.




Aucun commentaire:

Enregistrer un commentaire