DS#hasMany()

hasMany (type, options) Ember.computed Defined in addon/-private/system/relationships/has-many.js:11 DS.hasMany is used to define One-To-Many and Many-To-Many relationships on a DS.Model. DS.hasMany takes an optional hash as a second parameter, currently supported options are: async: A boolean value used to explicitly declare this to be an async relationship. inverse: A string used to identify the inverse property on a related model. One-To-Many To declare a one-to-many relationship betwe

DS#belongsTo()

belongsTo (modelName, options) Ember.computed Defined in addon/-private/system/relationships/belongs-to.js:5 DS.belongsTo is used to define One-To-One and One-To-Many relationships on a DS.Model. DS.belongsTo takes an optional hash as a second parameter, currently supported options are: async: A boolean value used to explicitly declare this to be an async relationship. inverse: A string used to identify the inverse property on a related model in a One-To-Many relationship. See Explicit In

DS#attr()

attr (type, options) Attribute Defined in addon/attr.js:38 DS.attr defines an attribute on a DS.Model. By default, attributes are passed through as-is, however you can specify an optional type to have the value automatically transformed. Ember Data ships with four basic transform types: string, number, boolean and date. You can define your own transforms by subclassing DS.Transform. Note that you cannot use attr to define an attribute of id. DS.attr takes an optional hash as a second parame

Displaying the Keys in an Object

Displaying the Keys in an Object If you need to display all of the keys or values of a JavaScript object in your template, you can use the {{#each-in}} helper: /app/components/store-categories.js import Ember from 'ember'; export default Ember.Component.extend({ willRender() { // Set the "categories" property to a JavaScript object // with the category name as the key and the value a list // of products. this.set('categories', { 'Bourbons': ['Bulleit', 'Four Roses', '

Displaying a List of Items

Displaying a List of Items To iterate over a list of items, use the {{#each}} helper. The first argument to this helper is the array to be iterated, and the value being iterated is yielded as a block param. Block params are only available inside the block of their helper. For example, this template iterates an array named people that contains objects. Each item in the array is provided as the block param person. <ul> {{#each people as |person|}} <li>Hello, {{person.name}}!&l

Disabling Prototype Extensions

Disabling Prototype Extensions By default, Ember.js will extend the prototypes of native JavaScript objects in the following ways: Array is extended to implement the Ember.Enumerable, Ember.MutableEnumerable, Ember.MutableArray and Ember.Array interfaces. This polyfills ECMAScript 5 array methods in browsers that do not implement them, adds convenience methods and properties to built-in arrays, and makes array mutations observable. String is extended to add convenience methods, such as cameli

Development Helpers

Development Helpers Development Helpers Handlebars and Ember come with a few helpers that can make developing your templates a bit easier. These helpers make it simple to output variables into your browser's console, or activate the debugger from your templates. Logging The {{log}} helper makes it easy to output variables or expressions in the current rendering context into your browser's console: {{log 'Name is:' name}} The {{log}} helper also accepts primitive types such as strings or numb

Descriptor

Descriptor Class PRIVATE Defined in: packages/ember-metal/lib/properties.js:13 Module: ember-metal Objects of this type can implement an interface to respond to requests to get and set. The default implementation handles simple properties.

Deploying

Deploying To deploy an Ember application simply transfer the output from ember build to a web server. This can be done with standard Unix file transfer tools such as rsync or scp. There are also services that will let you deploy easily. Deploying with scp You can deploy your application to any web server by copying the output from ember build to any web server: ember build scp -r dist/* myserver.com:/var/www/public/ Deploying to surge.sh Surge.sh allows you to publish any folder to the web f

Dependency Injection

Dependency Injection Ember applications utilize the dependency injection ("DI") design pattern to declare and instantiate classes of objects and dependencies between them. Applications and application instances each serve a role in Ember's DI implementation. An Ember.Application serves as a "registry" for dependency declarations. Factories (i.e. classes) are registered with an application, as well as rules about "injecting" dependencies that are applied when objects are instantiated. An Ember