DS.Store#peekRecord()

peekRecord (modelName, id) DS.Model|null

Defined in addon/-private/system/store.js:910
Available since 1.13.0

Get a record by a given type and ID without triggering a fetch.

This method will synchronously return the record if it is available in the store, otherwise it will return null. A record is available if it has been fetched earlier, or pushed manually into the store.

Note: This is an synchronous method and does not return a promise.

var post = store.peekRecord('post', 1);

post.get('id'); // 1

Parameters:

modelName String
id String|Integer

Returns:

DS.Model|null
record
doc_EmberJs
2016-11-30 16:50:53
Comments
Leave a Comment

Please login to continue.