RSVP.Promise#catch()

catch (onRejection, label) Promise Defined in bower_components/rsvp/lib/rsvp/promise.js:410 catch is simply sugar for then(undefined, onRejection) which makes it the same as the catch block of a try/catch statement. function findAuthor(){ throw new Error('couldn't find that author'); } // synchronous try { findAuthor(); } catch(reason) { // something went wrong } // async with promises findAuthor().catch(function(reason){ // something went wrong }); Parameters: onRejection Fun

Defining Your Routes

Defining Your Routes When your application starts, the router matches the current URL to the routes that you've defined. The routes, in turn, are responsible for displaying templates, loading data, and setting up application state. To define a route, run ember generate route route-name This creates a route file at app/routes/route-name.js, a template for the route at app/templates/route-name.hbs, and a unit test file at tests/unit/routes/route-name-test.js. It also adds the route to the rout

Array#indexOf()

indexOf (object, startAt) Numberpublic Defined in packages/ember-runtime/lib/mixins/array.js:370 Returns the index of the given object's first occurrence. If no startAt argument is given, the starting location to search is 0. If it's negative, will count backward from the end of the array. Returns -1 if no match is found. let arr = ['a', 'b', 'c', 'd', 'a']; arr.indexOf('a'); // 0 arr.indexOf('z'); // -1 arr.indexOf('a', 2); // 4 arr.indexOf('a', -1); // 4 arr.indexOf('

Observable#removeObserver()

removeObserver (key, target, method) public Defined in packages/ember-runtime/lib/mixins/observable.js:385 Remove an observer you have previously registered on this object. Pass the same key, target, and method you passed to addObserver() and your target will no longer receive notifications. Parameters: key String The key to observer target Object The target object to invoke method String|Function The method to invoke.

DS.Model#belongsTo()

belongsTo (name) BelongsToReference Defined in addon/-private/system/model/model.js:823 Available since 2.5.0 Get the reference for the specified belongsTo relationship. Example // models/blog.js export default DS.Model.extend({ user: DS.belongsTo({ async: true }) }); var blog = store.push({ type: 'blog', id: 1, relationships: { user: { type: 'user', id: 1 } } }); var userRef = blog.belongsTo('user'); // check if the user relationship is loaded var isLoaded = userRef.value()

DataAdapter#containerDebugAdapter

containerDebugAdapterpublic Defined in packages/ember-extension-support/lib/data_adapter.js:68 Available since 1.5.0 The container-debug-adapter which is used to list all models. Default: undefined

DS.Model#unloadRecord()

unloadRecordprivate Defined in addon/-private/system/model/model.js:582

RSVP.Promise#finally()

finally (callback, label) Promise Defined in bower_components/rsvp/lib/rsvp/promise.js:442 finally will be invoked regardless of the promise's fate just as native try/catch/finally behaves Synchronous example: findAuthor() { if (Math.random() > 0.5) { throw new Error(); } return new Author(); } try { return findAuthor(); // succeed or fail } catch(error) { return findOtherAuther(); } finally { // always runs // doesn't affect the return value } Asynchronous example: f

Observable#incrementProperty()

incrementProperty (keyName, increment) Numberpublic Defined in packages/ember-runtime/lib/mixins/observable.js:433 Set the value of a property to the current value plus some amount. person.incrementProperty('age'); team.incrementProperty('score', 2); Parameters: keyName String The name of the property to increment increment Number The amount to increment by. Defaults to 1 Returns: Number The new property value

DS.RESTAdapter#headersForRequest()

headersForRequest (params) Objectpublic Defined in addon/adapters/rest.js:1311 Get the headers for a request. By default the value of the headers property of the adapter is returned. Parameters: params Object Returns: Object headers