Routes
this.route('name', { path: '/' });
<LinkTo @route="photos.edit" @model={{photo.id}}>
{{photo.title}}
</LinkTo>
this.router.transitionTo(route, modelOrId);
Ember Data
const record = this.store.createRecord('model', { field });
await record.save();
record.field = 'updated value';
await record.save();
await record.destroyRecord();
this.store.findAll('model', {
reload: true,
include: ['foo', 'foo.bar'].join(','),
});
UUIDs
import JSONAPIAdapter from '@ember-data/adapter/json-api';
import { v4 } from 'uuid';
export default class ApplicationAdapter extends JSONAPIAdapter {
generateIdForRecord() {
return v4();
}
}