Route#afterModel()

afterModel (resolvedModel, transition) Promisepublic Defined in packages/ember-routing/lib/system/route.js:1334 This hook is called after this route's model has resolved. It follows identical async/promise semantics to beforeModel but is provided the route's resolved model in addition to the transition, and is therefore suited to performing logic that can only take place after the model has already resolved. App.PostsRoute = Ember.Route.extend({ afterModel: function(posts, transition) {

Unit Testing Basics

Unit Testing Basics Unit tests are generally used to test a small piece of code and ensure that it is doing what was intended. Unlike acceptance tests, they are narrow in scope and do not require the Ember application to be running. As it is the basic object type in Ember, being able to test a simple Ember.Object sets the foundation for testing more specific parts of your Ember application such as controllers, components, etc. Testing an Ember.Object is as simple as creating an instance of th

AutoLocation#cancelRouterSetup

cancelRouterSetupprivate Defined in packages/ember-routing/lib/location/auto_location.js:87 Available since 1.5.1 Default: false

MapWithDefault#copy()

copyEmber.MapWithDefaultprivate Inherited from Ember.Map but overwritten in packages/ember-metal/lib/map.js:468 Returns: Ember.MapWithDefault

Wrapping Content in a Component

Wrapping Content in a Component Sometimes, you may want to define a component that wraps content provided by other templates. For example, imagine we are building a blog-post component that we can use in our application to display a blog post: app/templates/components/blog-post.hbs <h1>{{title}}</h1> <div class="body">{{body}}</div> Now, we can use the {{blog-post}} component and pass it properties in another template: {{blog-post title=title body=body}} (See Passing

Function

Function Class Module: ember-runtime

DS.RESTAdapter#headers

headers{Object} Defined in addon/adapters/rest.js:384 Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary headers can be set as key/value pairs on the RESTAdapter's headers object and Ember Data will send them along with each ajax request. For dynamic headers see headers customization. app/adapters/application.js import DS from 'ember-data'; export default DS.RESTAdapter.extend({ headers: { "API_KEY": "secret key", "ANOTHER_HEADER": "Some header value" } });

Models

Introduction Models are objects that represent the underlying data that your application presents to the user. Different apps will have very different models, depending on what problems they're trying to solve. For example, a photo sharing application might have a Photo model to represent a particular photo, and a PhotoAlbum that represents a group of photos. In contrast, an online shopping app would probably have different models, like ShoppingCart, Invoice, or LineItem. Models tend to be pe

DS.Serializer

DS.Serializer Class Extends: Ember.Object Defined in: addon/serializer.js:7 Module: ember-data DS.Serializer is an abstract base class that you should override in your application to customize it for your backend. The minimum set of methods that you should implement is: normalizeResponse() serialize() And you can optionally override the following methods: normalize() For an example implementation, see DS.JSONSerializer, the included JSON serializer.

Ember.run.sync()

syncVoidprivate Defined in packages/ember-metal/lib/run_loop.js:288 Immediately flushes any events scheduled in the 'sync' queue. Bindings use this queue so this method is a useful way to immediately force all bindings in the application to sync. You should call this method anytime you need any changed state to propagate throughout the app immediately without repainting the UI (which happens in the later 'render' queue added by the ember-views package). run.sync(); Returns: Void