Conditionals

Conditionals Statements like if and unless are implemented as built-in helpers. Helpers can be invoked three ways, each of which is illustrated below with conditionals. The first style of invocation is inline invocation. This looks similar to displaying a property, but helpers accept arguments. For example: <div> {{if isFast "zoooom" "putt-putt-putt"}} </div> {{if}} in this case returns "zoooom" when isFast is true and "putt-putt-putt" when isFast is false. Helpers invoked as i

Route#_updatingQPChanged()

_updatingQPChangedprivate Defined in packages/ember-routing/lib/system/route.js:336

Route#controllerFor()

controllerFor (name) Ember.Controllerpublic Defined in packages/ember-routing/lib/system/route.js:1672 Returns the controller for a particular route or name. The controller instance must already have been created, either through entering the associated route or using generateController. App.PostRoute = Ember.Route.extend({ setupController: function(controller, post) { this._super(controller, post); this.controllerFor('posts').set('currentPost', post); } }); Parameters: name

DataAdapter#detect()

detect (klass) private Defined in packages/ember-extension-support/lib/data_adapter.js:249 Detect whether a class is a model. Test that against the model class of your persistence library. Parameters: klass Class The class to test. Returns: boolean Whether the class is a model class or not.

DS.Snapshot#changedAttributes()

changedAttributesObject Defined in addon/-private/system/snapshot.js:135 Returns all changed attributes and their old and new values. Example // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' }); postModel.set('title', 'Ember.js rocks!'); postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] } Returns: Object All changed attributes of the current snapshot

Ember.computed.setDiff()

setDiff (setAProperty, setBProperty) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:493 A computed property which returns a new array with all the properties from the first dependent array that are not in the second dependent array. Example let Hamster = Ember.Object.extend({ likes: ['banana', 'grape', 'kale'], wants: Ember.computed.setDiff('likes', 'fruits') }); let hamster = Hamster.create({ fruits: [ 'grape', 'kale',

Ember.computed.reads()

reads (dependentKey) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/computed_macros.js:568 This is a more semantically meaningful alias of computed.oneWay, whose name is somewhat ambiguous as to which direction the data flows. Parameters: dependentKey String Returns: Ember.ComputedProperty computed property which creates a one way computed property to the original value for property.

Configuring Your App

Configuring Your App Ember CLI ships with support for managing your application's environment. Ember CLI will setup a default environment config file at config/environment. Here, you can define an ENV object for each environment, which are currently limited to three: development, test, and production. The ENV object contains three important keys: EmberENV can be used to define Ember feature flags (see the Feature Flags guide). APP can be used to pass flags/options to your application instan

Route#model()

model (params, transition) Object|Promisepublic Defined in packages/ember-routing/lib/system/route.js:1405 A hook you can implement to convert the URL into the model for this route. App.Router.map(function() { this.route('post', { path: '/posts/:post_id' }); }); The model for the post route is store.findRecord('post', params.post_id). By default, if your route has a dynamic segment ending in _id: The model class is determined from the segment (post_id's class is App.Post) The find method

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