getAlias()
Returns the records stored under an alias, or fallbackRecords if the alias is not yet set.
Aliases are populated when a request is made with { alias: 'myAlias' } in the config.
If fallbackRecords is a plain object, ARM injects the record-level action methods into
it so it can be used as a placeholder record before the real data arrives.
Kind: global function
Returns: CollectionRecord | Array.<CollectionRecord> - The aliased records or the fallback.
| Param | Type | Description |
|---|---|---|
| aliasName | string | The alias name to look up. |
| [fallbackRecords] | Object | Array.<Object> | Returned as an observable if the alias is empty. |
Example
// Populate the alias via a request
ARM.findRecord('addresses', 123, null, { alias: 'currentAddress' })
// Read it back (returns fallback object until the request resolves)
const address = ARM.getAlias('currentAddress', {})Example
// Array alias
ARM.findAll('addresses', { alias: 'allAddresses' })
const addresses = ARM.getAlias('allAddresses', [])Last updated on