Skip to content

Instantly share code, notes, and snippets.

@richmolj
Created August 24, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save richmolj/73ab1d8875f978ad4d591d78d074639f to your computer and use it in GitHub Desktop.
Save richmolj/73ab1d8875f978ad4d591d78d074639f to your computer and use it in GitHub Desktop.
const fieldList = [
{ label: 'Foo Fields', fields: [{name: 'foo', selected: false}] },
{ label: 'Bar Fields', fields: [{name: 'bar', selected: true}] }
]
fields: Ember.computed('fieldList.@each', function() {
let fields = []
this.get('fieldList').forEach((config) => {
config.get('fields').forEach((field) => {
fields.push(field);
});
});
return fields;
}),
enabledFields: Ember.computed.filterBy('fields', 'selected', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment