DS.Store#getReference()

getReference (type, id) RecordReference

Defined in addon/-private/system/store.js:869
Available since 2.5.0

Get the reference for the specified record.

Example

var userRef = store.getReference('user', 1);

// check if the user is loaded
var isLoaded = userRef.value() !== null;

// get the record of the reference (null if not yet available)
var user = userRef.value();

// get the identifier of the reference
if (userRef.remoteType() === "id") {
var id = userRef.id();
}

// load user (via store.find)
userRef.load().then(...)

// or trigger a reload
userRef.reload().then(...)

// provide data for reference
userRef.push({ id: 1, username: "@user" }).then(function(user) {
userRef.value() === user;
});

Parameters:

type String
id String|Integer

Returns:

RecordReference
doc_EmberJs
2016-11-30 16:50:51
Comments
Leave a Comment

Please login to continue.