Bhavya Bansal
Bhavya Bansal

Reputation: 257

ember js query model for only certain params

If I have an ember model say Person with attributes like name, age, height, address etc, and I want to fetch all records in the model but only want name attribute in returned JSON (name is the only param needed, so no need to return all params of the model), then is there a way in Ember to do that? I searched for the query methods on Ember store but was not able to see any such example.

Thanks in advance.

Upvotes: 0

Views: 112

Answers (1)

Raghavendra Bhat
Raghavendra Bhat

Reputation: 76

You can try with

const listOfName = this.get('store').findAll('Person').mapBy('name')

For details refer mapBy

Upvotes: 1

Related Questions