Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the first record of model in emberjs

I need a way to get first record of specific model .at this time im using a way like this :

this.store.findAll('configModel').then(function(items) {
 items.get('content')[0].set('isEnableShowUniqueName', true);
 items.get('content')[0].set('isSavedToServer', false);
 items.get('content')[0].save();
});

but I think there is a better and ember way out there? is this way true? do you know any better way? but know this I haven't id of record I need the only first record of the model.

like image 549
MBehtemam Avatar asked Dec 04 '13 04:12

MBehtemam


1 Answers

You have firstObject, lastObject and objectAt.

items.get('firstObject');
like image 86
dagda1 Avatar answered Nov 17 '22 11:11

dagda1