JB2
JB2

Reputation: 1607

How do I access properties from within an Ember 2 component?

I am having some trouble accessing properties passed to my Ember component, which is as follows:

import Ember from 'ember';

export default Ember.Component.extend({
    isRowEditorActive: function() {
        return this.get('items').length > 0;
    }.property('items'),

    actions: {
        // My actions here
    }
});

The items (list of strings) that I pass in, can be accessed without problems within the template {{line-items-table items=['asd', 'asd']}}

However trying to get them within the component just returns undefined. Any suggestions?

Upvotes: 0

Views: 92

Answers (1)

Carl
Carl

Reputation: 760

As @kristjan says, you'll need to define your items for the line-item-table in the parent.

This is due to that the current version of handlebars don't support inline arrays, https://github.com/wycats/handlebars.js/issues/1058

Upvotes: 1

Related Questions