dimanche 22 janvier 2017

ember - how to get property name

In my template I would like to render the words "dstStartDate" and "dstStopDate"if that is their property.

Essentially my template would be like this


 renders "dstStartdate" or "dstStopDate"


I have a model file

import General from './General';
import DS from 'ember-data';

export default GenesysObject.extend({
    description: DS.attr('string'),
    dstOffset: DS.attr('number'),
    dstStartDate: DS.attr('string'),
    dstStopDate: DS.attr('string'),
    name: DS.attr('string'),
});

I've tried console logging Object.keys with the following code in my components file but just get something like http://ift.tt/2jEFDrt which is not what I want.

  valueType: computed('value', function() {
        var value = get(this, 'value');
        console.log(Object.keys(value));
        return typeOf(get(this, 'value'));

  })




Aucun commentaire:

Enregistrer un commentaire