DS.EmbeddedRecordsMixin#serializeBelongsTo()

serializeBelongsTo (snapshot, json, relationship) Defined in addon/serializers/embedded-records-mixin.js:141 Serialize belongsTo relationship when it is configured as an embedded object. This example of an author model belongs to a post model: Post = DS.Model.extend({ title: DS.attr('string'), body: DS.attr('string'), author: DS.belongsTo('author') }); Author = DS.Model.extend({ name: DS.attr('string'), post: DS.belongsTo('post') }); Use a custom (type) seriali

VisibilitySupport#_isVisibleDidChange()

_isVisibleDidChangeprivate Defined in packages/ember-views/lib/mixins/visibility_support.js:33 When the view's isVisible property changes, toggle the visibility element of the actual DOM element.

Embedding Applications

Embedding Applications In most cases, your application's entire UI will be created by templates that are managed by the router. But what if you have an Ember.js app that you need to embed into an existing page, or run alongside other JavaScript frameworks, or serve from the same domain as another app? Changing the Root Element By default, your application will render the application template and attach it to the document's body element. You can tell the application to append the application t

Relationships

Relationships Ember Data includes several built-in relationship types to help you define how your models relate to each other. One-to-One To declare a one-to-one relationship between two models, use DS.belongsTo: app/models/user.js import DS from 'ember-data'; export default DS.Model.extend({ profile: DS.belongsTo('profile') }); app/models/profile.js import DS from 'ember-data'; export default DS.Model.extend({ user: DS.belongsTo('user') }); One-to-Many To declare a one-to-many relati

DS.JSONAPISerializer#payloadTypeFromModelName()

payloadTypeFromModelName (modelname) Stringpublic Defined in addon/serializers/json-api.js:678 payloadTypeFromModelName can be used to change the mapping for the type in the payload, taken from the model name. Say your API namespaces the type of a model and expects the following payload when you update the post model: // POST /api/posts/1 { "data": { "id": 1, "type": "api::v1::post" } } By overwriting payloadTypeFromModelName you can specify that the namespaces model name for t

DS.ManyArray#save()

saveDS.PromiseArray Defined in addon/-private/system/many-array.js:244 Saves all of the records in the ManyArray. Example store.findRecord('inbox', 1).then(function(inbox) { inbox.get('messages').then(function(messages) { messages.forEach(function(message) { message.set('isRead', true); }); messages.save() }); }); Returns: DS.PromiseArray promise

DS.BuildURLMixin#_buildURL()

_buildURL (modelName, id) Stringprivate Defined in addon/-private/adapters/build-url-mixin.js:81 Parameters: modelName String id String Returns: String url

ArrayProxy

Ember.ArrayProxy Class PUBLIC Extends: Ember.Object Uses: Ember.MutableArray Defined in: packages/ember-runtime/lib/system/array_proxy.js:37 Module: ember-runtime An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, forwarding all requests. This makes it very useful for a number of binding use cases or other cases where being able to swap out the underlying array is useful. A simple example of usage: let pets = ['dog', 'cat', 'fish']; let ap = Ember.A

DS.RootState

DS.RootState Class Defined in: addon/-private/system/model/states.js:12 Module: ember-data State Each record has a currentState property that explicitly tracks what state a record is in at any given time. For instance, if a record is newly created and has not yet been sent to the adapter to be saved, it would be in the root.loaded.created.uncommitted state. If a record has had local modifications made to it that are in the process of being saved, the record would be in the root.loaded.upda

DS.Snapshot#type

type{DS.Model} Defined in addon/-private/system/snapshot.js:78 The type of the underlying record for this snapshot, as a DS.Model.