Route

Ember.Route Class PUBLIC Extends: Ember.Object Uses: Ember.ActionHandler Uses: Ember.Evented Defined in: packages/ember-routing/lib/system/route.js:75 Module: ember-routing The Ember.Route class is used to define individual routes. Refer to the routing guide for documentation.

Rendering a Template

Rendering a Template One job of a route handler is rendering the appropriate template to the screen. By default, a route handler will render the template with the same name as the route. Take this router: app/router.js Router.map(function() { this.route('posts', function() { this.route('new'); }); }); Here, the posts route will render the posts.hbs template, and the posts.new route will render posts/new.hbs. Each template will be rendered into the {{outlet}} of its parent route's tem

Route#activate event

activatepublic Defined in packages/ember-routing/lib/system/route.js:695 Available since 1.9.0 This event is triggered when the router enters the route. It is not executed when the model for the route changes. App.ApplicationRoute = Ember.Route.extend({ collectAnalytics: function(){ collectAnalytics(); }.on('activate') });

Rendering Performance

Rendering Performance You can use the Inspector to measure your app's render times. Click on Render Performance to start inspecting render times. Accuracy Using the Inspector adds a delay to your rendering, so the durations you see are not an accurate representation of the speed of your production apps. Use these times to compare durations and debug rendering bottlenecks, but not as a way to accurately measure rendering times. Toolbar Click on the "clear" icon to remove existing render logs.

Reopening Classes and Instances

Reopening Classes and Instances You don't need to define a class all at once. You can reopen a class and define new properties using the reopen() method. Person.reopen({ isPerson: true }); Person.create().get('isPerson'); // true When using reopen(), you can also override existing methods and call this._super. Person.reopen({ // override `say` to add an ! at the end say(thing) { this._super(thing + '!'); } }); reopen() is used to add instance methods and properties that are sha

RegistryProxyMixin#resolveRegistration()

resolveRegistration (fullName) Functionpublic Defined in packages/ember-runtime/lib/mixins/registry_proxy.js:19 Given a fullName return the corresponding factory. Parameters: fullName String Returns: Function fullName's factory

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

RegistryProxyMixin#unregister()

unregister (fullName) public Defined in packages/ember-runtime/lib/mixins/registry_proxy.js:90 Unregister a factory. let App = Ember.Application.create(); let User = Ember.Object.extend(); App.register('model:user', User); App.resolveRegistration('model:user').create() instanceof User //=> true App.unregister('model:user') App.resolveRegistration('model:user') === undefined //=> true Parameters: fullName String

RegistryProxyMixin#registeredOptions()

registeredOptions (fullName) Objectpublic Defined in packages/ember-runtime/lib/mixins/registry_proxy.js:152 Return registered options for a particular factory. Parameters: fullName String Returns: Object options

RegistryProxyMixin#registeredOptionsForType()

registeredOptionsForType (type) Objectpublic Defined in packages/ember-runtime/lib/mixins/registry_proxy.js:193 Return the registered options for all factories of a type. Parameters: type String Returns: Object options