diff --git a/source/applications/applications-and-instances.md b/source/applications/applications-and-instances.md index 4d37e5a47..95aacbf3c 100644 --- a/source/applications/applications-and-instances.md +++ b/source/applications/applications-and-instances.md @@ -1,8 +1,8 @@ -Every Ember application is represented by a class that extends [`Application`](https://emberjs.com/api/ember/2.16/classes/Application). +Every Ember application is represented by a class that extends [`Application`](https://emberjs.com/api/ember/release/classes/Application). This class is used to declare and configure the many objects that make up your app. As your application boots, -it creates an [`ApplicationInstance`](https://emberjs.com/api/ember/2.16/classes/ApplicationInstance) that is used to manage its stateful aspects. +it creates an [`ApplicationInstance`](https://emberjs.com/api/ember/release/classes/ApplicationInstance) that is used to manage its stateful aspects. This instance acts as the "owner" of objects instantiated for your app. Essentially, the `Application` *defines your application* diff --git a/source/applications/dependency-injection.md b/source/applications/dependency-injection.md index bb309e1ea..4fff524cc 100644 --- a/source/applications/dependency-injection.md +++ b/source/applications/dependency-injection.md @@ -2,11 +2,11 @@ Ember applications utilize the [dependency injection](https://en.wikipedia.org/w ("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 [`Application`](https://emberjs.com/api/ember/2.16/classes/Application) serves as a "registry" for dependency declarations. +An [`Application`](https://emberjs.com/api/ember/release/classes/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 [`ApplicationInstance`](https://emberjs.com/api/ember/2.16/classes/ApplicationInstance) serves as the "owner" for objects that are instantiated from registered factories. +An [`ApplicationInstance`](https://emberjs.com/api/ember/release/classes/ApplicationInstance) serves as the "owner" for objects that are instantiated from registered factories. Application instances provide a means to "look up" (i.e. instantiate and / or retrieve) objects. > _Note: Although an `Application` serves as the primary registry for an app, @@ -194,7 +194,7 @@ export default Component.extend({ ## Factory Instance Lookups To fetch an instantiated factory from the running application you can call the -[`lookup`](https://emberjs.com/api/ember/2.16/classes/ApplicationInstance/methods/lookup?anchor=lookup) method on an application instance. This method takes a string +[`lookup`](https://emberjs.com/api/ember/release/classes/ApplicationInstance/methods/lookup?anchor=lookup) method on an application instance. This method takes a string to identify a factory and returns the appropriate object. ```javascript @@ -225,9 +225,9 @@ export default { ### Getting an Application Instance from a Factory Instance -[`Ember.getOwner`](https://emberjs.com/api/ember/2.16/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) will retrieve the application instance that "owns" an +[`Ember.getOwner`](https://emberjs.com/api/ember/release/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) will retrieve the application instance that "owns" an object. This means that framework objects like components, helpers, and routes -can use [`Ember.getOwner`](https://emberjs.com/api/ember/2.16/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) to perform lookups through their application +can use [`Ember.getOwner`](https://emberjs.com/api/ember/release/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) to perform lookups through their application instance at runtime. For example, this component plays songs with different audio services based diff --git a/source/applications/run-loop.md b/source/applications/run-loop.md index 022bef334..6680fc416 100644 --- a/source/applications/run-loop.md +++ b/source/applications/run-loop.md @@ -198,9 +198,9 @@ $('a').click(() => { }); ``` -The run loop API calls that _schedule_ work, i.e. [`run.schedule`](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Frunloop/methods/schedule?anchor=schedule), -[`run.scheduleOnce`](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Frunloop/methods/scheduleOnce?anchor=scheduleOnce), -[`run.once`](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Frunloop/methods/once?anchor=once) have the property that they will approximate a run loop for you if one does not already exist. +The run loop API calls that _schedule_ work, i.e. [`run.schedule`](https://www.emberjs.com/api/ember/release/classes/@ember%2Frunloop/methods/schedule?anchor=schedule), +[`run.scheduleOnce`](https://www.emberjs.com/api/ember/release/classes/@ember%2Frunloop/methods/scheduleOnce?anchor=scheduleOnce), +[`run.once`](https://www.emberjs.com/api/ember/release/classes/@ember%2Frunloop/methods/once?anchor=once) have the property that they will approximate a run loop for you if one does not already exist. These automatically created run loops we call _autoruns_. Here is some pseudocode to describe what happens using the example above: @@ -265,5 +265,5 @@ Disabling autoruns help you identify these scenarios and helps both your testing ## Where can I find more information? -Check out the [Ember.run](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Frunloop) API documentation, +Check out the [Ember.run](https://www.emberjs.com/api/ember/release/classes/@ember%2Frunloop) API documentation, as well as the [Backburner library](https://github.com/ebryn/backburner.js/) that powers the run loop. diff --git a/source/applications/services.md b/source/applications/services.md index 475962877..7a819b450 100644 --- a/source/applications/services.md +++ b/source/applications/services.md @@ -1,4 +1,4 @@ -A [`Service`](https://www.emberjs.com/api/ember/2.16/modules/@ember%2Fservice) is an Ember object that lives for the duration of the application, and can be made available in different parts of your application. +A [`Service`](https://www.emberjs.com/api/ember/release/modules/@ember%2Fservice) is an Ember object that lives for the duration of the application, and can be made available in different parts of your application. Services are useful for features that require shared state or persistent connections. Example uses of services might include: @@ -20,7 +20,7 @@ For example, the following command will create the `ShoppingCart` service: ember generate service shopping-cart ``` -Services must extend the [`Service`](https://www.emberjs.com/api/ember/2.16/modules/@ember%2Fservice) base class: +Services must extend the [`Service`](https://www.emberjs.com/api/ember/release/modules/@ember%2Fservice) base class: ```app/services/shopping-cart.js import Service from '@ember/service'; @@ -92,7 +92,7 @@ This injects the shopping cart service into the component and makes it available Sometimes a service may or may not exist, like when an initializer conditionally registers a service. Since normal injection will throw an error if the service doesn't exist, -you must look up the service using Ember's [`getOwner`](https://emberjs.com/api/ember/2.16/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) instead. +you must look up the service using Ember's [`getOwner`](https://emberjs.com/api/ember/release/classes/@ember%2Fapplication/methods/getOwner?anchor=getOwner) instead. ```app/components/cart-contents.js import Component from '@ember/component'; diff --git a/source/components/defining-a-component.md b/source/components/defining-a-component.md index c01cd415f..b637f3b90 100644 --- a/source/components/defining-a-component.md +++ b/source/components/defining-a-component.md @@ -42,7 +42,7 @@ export default Route.extend({ }); ``` -Each component is backed by an element under the hood. By default, +Each component is backed by an element under the hood. By default, Ember will use a `
` element to contain your component's template. To learn how to change the element Ember uses for your component, see [Customizing a Component's @@ -58,7 +58,7 @@ the Handlebars template as described above and use the component that is created. If you need to customize the behavior of the component you'll -need to define a subclass of [`Component`](https://www.emberjs.com/api/ember/2.16/classes/Component). For example, you would +need to define a subclass of [`Component`](https://www.emberjs.com/api/ember/release/classes/Component). For example, you would need a custom subclass if you wanted to change a component's element, respond to actions from the component's template, or manually make changes to the component's element using JavaScript. @@ -71,7 +71,7 @@ file at `app/components/blog-post.js`. If your component was called ## Dynamically rendering a component -The [`{{component}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/component?anchor=component) helper can be used to defer the selection of a component to +The [`{{component}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/component?anchor=component) helper can be used to defer the selection of a component to run time. The `{{my-component}}` syntax always renders the same component, while using the `{{component}}` helper allows choosing a component to render on the fly. This is useful in cases where you want to interact with different @@ -81,7 +81,7 @@ allow you to keep different logic well separated. The first parameter of the helper is the name of a component to render, as a string. So `{{component 'blog-post'}}` is the same as using `{{blog-post}}`. -The real value of [`{{component}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/component?anchor=component) comes from being able to dynamically pick +The real value of [`{{component}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/component?anchor=component) comes from being able to dynamically pick the component being rendered. Below is an example of using the helper as a means of choosing different components for displaying different kinds of posts: diff --git a/source/components/handling-events.md b/source/components/handling-events.md index d7d337431..ca0bd616a 100644 --- a/source/components/handling-events.md +++ b/source/components/handling-events.md @@ -129,7 +129,7 @@ To utilize an `event` object as a function parameter: The event handling examples described above respond to one set of events. The names of the built-in events are listed below. Custom events can be -registered by using [Application.customEvents](https://www.emberjs.com/api/ember/2.16/classes/Application/properties/customEvents?anchor=customEvents). +registered by using [Application.customEvents](https://www.emberjs.com/api/ember/release/classes/Application/properties/customEvents?anchor=customEvents). Touch events: diff --git a/source/components/passing-properties-to-a-component.md b/source/components/passing-properties-to-a-component.md index 1f274d121..b2bca4e3a 100644 --- a/source/components/passing-properties-to-a-component.md +++ b/source/components/passing-properties-to-a-component.md @@ -66,7 +66,7 @@ In other words, you can invoke the above component example like this: ``` To set the component up to receive parameters this way, you need to -set the [`positionalParams`](https://www.emberjs.com/api/ember/2.16/classes/Component/properties/positionalParams?anchor=positionalParams) attribute in your component class. +set the [`positionalParams`](https://www.emberjs.com/api/ember/release/classes/Component/properties/positionalParams?anchor=positionalParams) attribute in your component class. ```app/components/blog-post.js import Component from '@ember/component'; diff --git a/source/components/the-component-lifecycle.md b/source/components/the-component-lifecycle.md index b6d377f00..c5b3bc57e 100644 --- a/source/components/the-component-lifecycle.md +++ b/source/components/the-component-lifecycle.md @@ -198,8 +198,8 @@ There are a few things to note about the `didInsertElement()` hook: - While [`didInsertElement()`][did-insert-element] is technically an event that can be listened for using `on()`, it is encouraged to override the default method itself, particularly when order of execution is important. -[did-insert-element]: https://www.emberjs.com/api/ember/2.16/classes/Component/events/didInsertElement?anchor=didInsertElement -[dollar]: https://www.emberjs.com/api/ember/2.16/classes/Component/methods/$?anchor=%24 +[did-insert-element]: https://www.emberjs.com/api/ember/release/classes/Component/events/didInsertElement?anchor=didInsertElement +[dollar]: https://www.emberjs.com/api/ember/release/classes/Component/methods/$?anchor=%24 [event-names]: http://guides.emberjs.com/v2.1.0/components/handling-events/#toc_event-names ### Making Updates to the Rendered DOM with `didRender` @@ -254,7 +254,7 @@ export default Component.extend({ ### Detaching and Tearing Down Component Elements with `willDestroyElement` -When a component detects that it is time to remove itself from the DOM, Ember will trigger the [`willDestroyElement()`](https://www.emberjs.com/api/ember/2.16/classes/Component/events/willDestroyElement?anchor=willDestroyElement) method, +When a component detects that it is time to remove itself from the DOM, Ember will trigger the [`willDestroyElement()`](https://www.emberjs.com/api/ember/release/classes/Component/events/willDestroyElement?anchor=willDestroyElement) method, allowing for any teardown logic to be performed. Component teardown can be triggered by a number of different conditions. diff --git a/source/components/wrapping-content-in-a-component.md b/source/components/wrapping-content-in-a-component.md index 0f659a45e..321a67d6b 100644 --- a/source/components/wrapping-content-in-a-component.md +++ b/source/components/wrapping-content-in-a-component.md @@ -65,7 +65,7 @@ We will give them the option to specify either `markdown-style` or `html-style`. Supporting different editing styles will require different body components to provide special validation and highlighting. To load a different body component based on editing style, -you can yield the component using the [`component helper`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/component?anchor=component) and [`hash helper`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/hash?anchor=hash). +you can yield the component using the [`component helper`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/component?anchor=component) and [`hash helper`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/hash?anchor=hash). Here, the appropriate component is assigned to a hash using nested helpers and yielded to the template. Notice `editStyle` being used as an argument to the component helper. diff --git a/source/configuring-ember/disabling-prototype-extensions.md b/source/configuring-ember/disabling-prototype-extensions.md index 3302ae738..51c327e25 100644 --- a/source/configuring-ember/disabling-prototype-extensions.md +++ b/source/configuring-ember/disabling-prototype-extensions.md @@ -9,7 +9,7 @@ objects in the following ways: * `String` is extended to add convenience methods, such as `camelize()` and `w()`. You can find a list of these methods with the - [Ember.String documentation](https://www.emberjs.com/api/ember/2.16/classes/String). + [Ember.String documentation](https://www.emberjs.com/api/ember/release/classes/String). * `Function` is extended with methods to annotate functions as computed properties, via the `property()` method, and as observers, @@ -90,7 +90,7 @@ islands.includes('Oahu'); ### Strings Strings will no longer have the convenience methods described in the -[`Ember.String` API reference](https://www.emberjs.com/api/ember/2.16/classes/String). +[`Ember.String` API reference](https://www.emberjs.com/api/ember/release/classes/String). Instead, you can use the similarly-named methods of the `Ember.String` object and pass the string to use as the first parameter: @@ -147,7 +147,7 @@ fullNameDidChange: observer('fullName', function() { }) ``` -Evented functions are annotated using `Ember.on()`: +Evented functions are annotated using [`Ember.on()`](https://emberjs.com/api/ember/2.15/namespaces/Ember/methods/on?anchor=on): ```javascript import { on } from '@ember/object/evented'; diff --git a/source/configuring-ember/handling-deprecations.md b/source/configuring-ember/handling-deprecations.md index 93dd1bd0c..6d3706f1f 100644 --- a/source/configuring-ember/handling-deprecations.md +++ b/source/configuring-ember/handling-deprecations.md @@ -10,7 +10,7 @@ Fortunately, Ember provides a way for projects to deal with deprecations in an o ## Filtering Deprecations When your project has a lot of deprecations, you can start by filtering out deprecations that do not have to be addressed right away. You -can use the [deprecation handlers](http://emberjs.com/api/classes/Ember.Debug.html#method_registerDeprecationHandler) API to check for what +can use the [deprecation handlers](https://emberjs.com/api/ember/2.15/classes/Ember.Debug/methods/registerDeprecationHandler?anchor=registerDeprecationHandler) API to check for what release a deprecated feature will be removed. An example handler is shown below that filters out all deprecations that are not going away in release 2.0.0. diff --git a/source/models/creating-updating-and-deleting-records.md b/source/models/creating-updating-and-deleting-records.md index 2edfaf6b8..e40d9fe23 100644 --- a/source/models/creating-updating-and-deleting-records.md +++ b/source/models/creating-updating-and-deleting-records.md @@ -27,7 +27,7 @@ this.get('store').findRecord('person', 1).then(function(tyrion) { All of the Ember.js conveniences are available for modifying attributes. For example, you can use `Ember.Object`'s -[`incrementProperty`](http://emberjs.com/api/classes/Ember.Object.html#method_incrementProperty) helper: +[`incrementProperty`](https://emberjs.com/api/ember/2.15/classes/Ember.Object/methods/incrementProperty?anchor=incrementProperty) helper: ```js person.incrementProperty('age'); // Happy birthday! diff --git a/source/models/customizing-adapters.md b/source/models/customizing-adapters.md index f88bf4720..801c90731 100644 --- a/source/models/customizing-adapters.md +++ b/source/models/customizing-adapters.md @@ -235,7 +235,7 @@ export default DS.JSONAPIAdapter.extend({ In some cases, your dynamic headers may require data from some object outside of Ember's observer system (for example `document.cookie`). You can use the -[volatile](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject%2Fcomputed/methods/property?anchor=volatile&show=inherited%2Cprotected%2Cprivate%2Cdeprecated) +[volatile](https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject%2Fcomputed/methods/property?anchor=volatile) function to set the property into a non-cached mode causing the headers to be recomputed with every request. diff --git a/source/models/finding-records.md b/source/models/finding-records.md index c271b9116..9939d4b33 100644 --- a/source/models/finding-records.md +++ b/source/models/finding-records.md @@ -32,7 +32,7 @@ let blogPosts = this.get('store').peekAll('blog-post'); // => no network request `store.findAll()` returns a `DS.PromiseArray` that fulfills to a `DS.RecordArray` and `store.peekAll` directly returns a `DS.RecordArray`. -It's important to note that `DS.RecordArray` is not a JavaScript array, it's an object that implements [`Ember.Enumerable`](http://emberjs.com/api/classes/Ember.Enumerable.html). +It's important to note that `DS.RecordArray` is not a JavaScript array, it's an object that implements [`Ember.Enumerable`](https://emberjs.com/api/ember/release/classes/Ember.Enumerable). This is important because, for example, if you want to retrieve records by index, the `[]` notation will not work--you'll have to use `objectAt(index)` instead. diff --git a/source/models/pushing-records-into-the-store.md b/source/models/pushing-records-into-the-store.md index d30c82590..24eb41745 100644 --- a/source/models/pushing-records-into-the-store.md +++ b/source/models/pushing-records-into-the-store.md @@ -19,7 +19,7 @@ you want to update the UI immediately. ### Pushing Records -To push a record into the store, call the store's [`push()`](https://www.emberjs.com/api/ember-data/2.16/classes/DS.Store/methods/push?anchor=push) method. +To push a record into the store, call the store's [`push()`](https://www.emberjs.com/api/ember-data/release/classes/DS.Store/methods/push?anchor=push) method. For example, imagine we want to preload some data into the store when the application boots for the first time. @@ -78,7 +78,7 @@ the casing of the properties defined on the Model class. If you would like the data to be normalized by the model's default serializer before pushing it into the store, you can use the -[`store.pushPayload()`](https://www.emberjs.com/api/ember-data/2.16/classes/DS.Store/methods/push?anchor=pushPayload) method. +[`store.pushPayload()`](https://www.emberjs.com/api/ember-data/release/classes/DS.Store/methods/push?anchor=pushPayload) method. ```app/serializers/album.js import DS from 'ember-data'; diff --git a/source/models/relationships.md b/source/models/relationships.md index bea21c388..efe611db5 100644 --- a/source/models/relationships.md +++ b/source/models/relationships.md @@ -340,7 +340,7 @@ include those related records in the response returned to the client. The value of the parameter should be a comma-separated list of names of the relationships required. -If you are using an adapter that supports JSON API, such as Ember's default [`JSONAPIAdapter`](https://www.emberjs.com/api/ember-data/2.16/classes/DS.JSONAPIAdapter), +If you are using an adapter that supports JSON API, such as Ember's default [`JSONAPIAdapter`](https://www.emberjs.com/api/ember-data/release/classes/DS.JSONAPIAdapter), you can easily add the `include` parameter to the server requests created by the `findRecord()`, `findAll()`, `query()` and `queryRecord()` methods. diff --git a/source/object-model/bindings.md b/source/object-model/bindings.md index 8077c1b7e..9c0652ddf 100644 --- a/source/object-model/bindings.md +++ b/source/object-model/bindings.md @@ -3,6 +3,7 @@ bindings in Ember.js can be used with any object. That said, bindings are most often used within the Ember framework itself, and for most problems Ember app developers face, computed properties are the appropriate solution. + The easiest way to create a two-way binding is to use a [`computed.alias()`](https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject%2Fcomputed/methods/alias?anchor=alias&show=inherited%2Cprotected%2Cprivate%2Cdeprecated), that specifies the path to another object. diff --git a/source/object-model/classes-and-instances.md b/source/object-model/classes-and-instances.md index 3927f02c4..7b2267cce 100644 --- a/source/object-model/classes-and-instances.md +++ b/source/object-model/classes-and-instances.md @@ -7,8 +7,8 @@ as other major features of the Ember object model. To define a new Ember _class_, call the [`extend()`][1] method on [`EmberObject`][2]: -[1]: https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject/methods/extend?anchor=extend -[2]: https://www.emberjs.com/api/ember/2.16/modules/@ember%2Fobject +[1]: https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject/methods/extend?anchor=extend +[2]: https://www.emberjs.com/api/ember/release/modules/@ember%2Fobject ```javascript import EmberObject from '@ember/object'; @@ -26,7 +26,7 @@ You can also create a _subclass_ from any existing class by calling its `extend()` method. For example, you might want to create a subclass of Ember's built-in [`Component`][3] class: -[3]: https://www.emberjs.com/api/ember/2.16/classes/Component +[3]: https://www.emberjs.com/api/ember/release/classes/Component ```app/components/todo-item.js import Component from '@ember/component'; @@ -75,7 +75,7 @@ One common example is when overriding the [`normalizeResponse()`][4] hook in one A handy shortcut for this is to use a "spread operator", like `...arguments`: -[4]: https://www.emberjs.com/api/ember-data/2.16/classes/DS.JSONAPISerializer/methods/normalizeResponse?anchor=normalizeResponse +[4]: https://www.emberjs.com/api/ember-data/release/classes/DS.JSONAPISerializer/methods/normalizeResponse?anchor=normalizeResponse ```javascript normalizeResponse(store, primaryModelClass, payload, id, requestType) { @@ -93,7 +93,7 @@ class by calling its [`create()`][5] method. Any methods, properties and computed properties you defined on the class will be available to instances: -[5]: https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject/methods/create?anchor=create +[5]: https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject/methods/create?anchor=create ```javascript import EmberObject from '@ember/object'; @@ -145,7 +145,7 @@ When a new instance is created, its [`init()`][6] method is invoked automatically. This is the ideal place to implement setup required on new instances: -[6]: https://www.emberjs.com/api/ember/2.16/classes/EmberObject/methods/init?anchor=init +[6]: https://www.emberjs.com/api/ember/release/classes/EmberObject/methods/init?anchor=init ```js import EmberObject from '@ember/object'; @@ -229,8 +229,8 @@ Person.create({ When accessing the properties of an object, use the [`get()`][7] and [`set()`][8] accessor methods: -[7]: https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject/methods/get?anchor=get -[8]: https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject/methods/set?anchor=set +[7]: https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject/methods/get?anchor=get +[8]: https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject/methods/set?anchor=set ```js import EmberObject from '@ember/object'; diff --git a/source/object-model/computed-properties-and-aggregate-data.md b/source/object-model/computed-properties-and-aggregate-data.md index 14cefe2fa..b26c36a1f 100644 --- a/source/object-model/computed-properties-and-aggregate-data.md +++ b/source/object-model/computed-properties-and-aggregate-data.md @@ -45,7 +45,7 @@ you would declare the dependency with braces: `todos.@each.{priority,title}` ### Computed Property Macros Ember also provides a computed property macro -[`computed.filterBy`](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject%2Fcomputed/methods/alias?anchor=filterBy&show=inherited%2Cprotected%2Cprivate%2Cdeprecated), +[`computed.filterBy`](https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject%2Fcomputed/methods/alias?anchor=filterBy), which is a shorter way of expressing the above computed property: ```app/components/todo-list.js @@ -133,10 +133,10 @@ export default Component.extend({ Here, `indexOfSelectedTodo` depends on `todos.[]`, so it will update if we add an item to `todos`, but won't update if the value of `isDone` on a `todo` changes. -Several of the [Ember.computed](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject%2Fcomputed) macros +Several of the [Ember.computed](https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject%2Fcomputed) macros utilize the `[]` key to implement common use-cases. For instance, to create a computed property that mapped properties from an array, you could use -[Ember.computed.map](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject%2Fcomputed/methods/map?anchor=map) +[Ember.computed.map](https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject%2Fcomputed/methods/map?anchor=map) or build the computed property yourself: ```javascript diff --git a/source/object-model/computed-properties.md b/source/object-model/computed-properties.md index fe19fabc6..13c5a39d9 100644 --- a/source/object-model/computed-properties.md +++ b/source/object-model/computed-properties.md @@ -206,4 +206,4 @@ Person = EmberObject.extend({ ``` To see the full list of computed property macros, have a look at -[the API documentation](https://www.emberjs.com/api/ember/2.16/modules/@ember%2Fobject) +[the API documentation](https://www.emberjs.com/api/ember/release/modules/@ember%2Fobject) diff --git a/source/object-model/enumerables.md b/source/object-model/enumerables.md index 8a5f4b185..78fc0ab29 100644 --- a/source/object-model/enumerables.md +++ b/source/object-model/enumerables.md @@ -1,6 +1,6 @@ In Ember.js, an enumerable is any object that contains a number of child objects, and which allows you to work with those children using the -[Ember.Enumerable](http://emberjs.com/api/classes/Ember.Enumerable.html) API. The most common +[Ember.Enumerable](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable) API. The most common enumerable in the majority of apps is the native JavaScript array, which Ember.js extends to conform to the enumerable interface. @@ -46,11 +46,11 @@ in an observable fashion, you should use `myArray.get('firstObject')` and In the rest of this guide, we'll explore some of the most common enumerable conveniences. For the full list, please see the [Ember.Enumerable API -reference documentation.](http://emberjs.com/api/classes/Ember.Enumerable.html) +reference documentation.](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable) ### Iterating Over an Enumerable -To enumerate all the values of an enumerable object, use the [`forEach()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_forEach) +To enumerate all the values of an enumerable object, use the [`forEach()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/forEach?anchor=forEach) method: @@ -68,7 +68,7 @@ food.forEach((item, index) => { ### First and Last Objects -All enumerables expose [`firstObject`](http://emberjs.com/api/classes/Ember.Enumerable.html#property_firstObject) and [`lastObject`](http://emberjs.com/api/classes/Ember.Enumerable.html#property_lastObject) properties +All enumerables expose [`firstObject`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/properties/firstObject?anchor=firstObject) and [`lastObject`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/properties/lastObject?anchor=lastObject) properties that you can bind to. @@ -88,7 +88,7 @@ animals.get('lastObject'); ### Map You can easily transform each item in an enumerable using the -[`map()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_map) method, which creates a new array with results of calling a +[`map()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/map?anchor=map) method, which creates a new array with results of calling a function on each item in the enumerable. @@ -99,7 +99,7 @@ let emphaticWords = words.map(item => `${item}!`); //=> ["goodbye!", "cruel!", "world!"] ``` -If your enumerable is composed of objects, there is a [`mapBy()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_mapBy) +If your enumerable is composed of objects, there is a [`mapBy()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/mapBy?anchor=mapBy) method that will extract the named property from each of those objects in turn and return a new array: @@ -127,7 +127,7 @@ Another common task to perform on an enumerable is to take the enumerable as input, and return an Array after filtering it based on some criteria. -For arbitrary filtering, use the [`filter()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_filter) method. The filter method +For arbitrary filtering, use the [`filter()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/filter?anchor=filter) method. The filter method expects the callback to return `true` if Ember should include it in the final Array, and `false` or `undefined` if Ember should not. @@ -140,7 +140,7 @@ arr.filter((item, index, self) => item < 4); //=> [1, 2, 3] ``` -When working with a collection of Ember objects, you will often want to filter a set of objects based upon the value of some property. The [`filterBy()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_filterBy) method provides a shortcut. +When working with a collection of Ember objects, you will often want to filter a set of objects based upon the value of some property. The [`filterBy()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/filterBy?anchor=filterBy) method provides a shortcut. ```javascript @@ -162,14 +162,14 @@ todos.filterBy('isDone', true); ``` If you only want to return the first matched value, rather than an Array -containing all of the matched values, you can use [`find()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_find) and [`findBy()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_findBy), +containing all of the matched values, you can use [`find()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/find?anchor=find) and [`findBy()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/findBy?anchor=findBy), which work like `filter()` and `filterBy()`, but return only one item. ### Aggregate Information (Every or Any) To find out whether every item in an enumerable matches some condition, you can -use the [`every()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_every) method: +use the [`every()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/every?anchor=every) method: ```javascript @@ -191,7 +191,7 @@ people.every((person, index, self) => person.get('isHappy')); ``` To find out whether at least one item in an enumerable matches some condition, -you can use the [`any()`](http://emberjs.com/api/classes/Ember.Enumerable.html#method_any) method: +you can use the [`any()`](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable/methods/any?anchor=any) method: ```javascript @@ -200,7 +200,7 @@ people.any((person, index, self) => person.get('isHappy')); //=> true ``` -Like the filtering methods, the `every()` and `any()` methods have +Like the filtering methods, the `every()` and `any()` methods have analogous `isEvery()` and `isAny()` methods. ```javascript diff --git a/source/object-model/index.md b/source/object-model/index.md index 5d12ad6da..fbf97c500 100644 --- a/source/object-model/index.md +++ b/source/object-model/index.md @@ -6,13 +6,13 @@ JavaScript objects don't support the observation of property value changes. Consequently, if an object is going to participate in Ember's binding system you may see an `Ember.Object` instead of a plain object. -[Ember.Object](https://www.emberjs.com/api/ember/2.16/modules/@ember%2Fobject) also provides a class system, supporting features like mixins +[Ember.Object](https://www.emberjs.com/api/ember/release/modules/@ember%2Fobject) also provides a class system, supporting features like mixins and constructor methods. Some features in Ember's object model are not present in JavaScript classes or common patterns, but all are aligned as much as possible with the language and proposed additions. Ember also extends the JavaScript `Array` prototype with its -[Ember.Enumerable](http://emberjs.com/api/classes/Ember.Enumerable.html) interface to provide change observation for arrays. +[Ember.Enumerable](https://emberjs.com/api/ember/2.15/classes/Ember.Enumerable) interface to provide change observation for arrays. Finally, Ember extends the `String` prototype with a few [formatting and -localization methods](https://www.emberjs.com/api/ember/2.16/classes/String). +localization methods](https://www.emberjs.com/api/ember/release/classes/String). diff --git a/source/object-model/observers.md b/source/object-model/observers.md index d98f3c087..783313388 100644 --- a/source/object-model/observers.md +++ b/source/object-model/observers.md @@ -79,7 +79,7 @@ person.set('firstName', 'John'); person.set('lastName', 'Smith'); ``` -To get around these problems, you should make use of [`Ember.run.once()`](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Frunloop/methods/once?anchor=once). +To get around these problems, you should make use of [`Ember.run.once()`](https://www.emberjs.com/api/ember/release/classes/@ember%2Frunloop/methods/once?anchor=once). This will ensure that any processing you need to do only happens once, and happens in the next run loop once all bindings are synchronized: @@ -110,7 +110,7 @@ Observers never fire until after the initialization of an object is complete. If you need an observer to fire as part of the initialization process, you cannot rely on the side effect of `set`. Instead, specify that the observer -should also run after `init` by using [`Ember.on()`](http://emberjs.com/api/classes/Ember.html#method_on): +should also run after `init` by using [`Ember.on()`](https://emberjs.com/api/ember/2.15/namespaces/Ember/methods/on?anchor=on): ```javascript @@ -145,7 +145,7 @@ get it in your `init()` method. ### Outside of class definitions You can also add observers to an object outside of a class definition -using [`addObserver()`](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fobject%2Fobservers/methods/addObserver?anchor=addObserver): +using [`addObserver()`](https://www.emberjs.com/api/ember/release/classes/@ember%2Fobject%2Fobservers/methods/addObserver?anchor=addObserver): ```javascript diff --git a/source/object-model/reopening-classes-and-instances.md b/source/object-model/reopening-classes-and-instances.md index d10969f05..e7727b697 100644 --- a/source/object-model/reopening-classes-and-instances.md +++ b/source/object-model/reopening-classes-and-instances.md @@ -1,6 +1,6 @@ You don't need to define a class all at once. You can reopen a class and define new properties using the -[`reopen()`](http://emberjs.com/api/classes/Ember.Object.html#method_reopen) +[`reopen()`](https://emberjs.com/api/ember/2.15/classes/Ember.Object/methods/reopen?anchor=reopen) method. ```javascript @@ -24,12 +24,12 @@ Person.reopen({ }); ``` -`reopen()` is used to add instance methods and properties that are shared +`reopen()` is used to add instance methods and properties that are shared across all instances of a class. It does not add methods and properties to a particular instance of a class as in vanilla JavaScript (without using prototype). But when you need to add static methods or static properties to the class itself -you can use [`reopenClass()`](http://emberjs.com/api/classes/Ember.Object.html#method_reopenClass). +you can use [`reopenClass()`](https://emberjs.com/api/ember/2.15/classes/Ember.Object/methods/reopenClass?anchor=reopenClass). ```javascript // add static property to class diff --git a/source/routing/defining-your-routes.md b/source/routing/defining-your-routes.md index 12abbdf46..c202db8e3 100644 --- a/source/routing/defining-your-routes.md +++ b/source/routing/defining-your-routes.md @@ -14,7 +14,7 @@ It also adds the route to the router. ## Basic Routes -The [`map()`](https://www.emberjs.com/api/ember/2.16/classes/Router/methods/map?anchor=map) method +The [`map()`](https://www.emberjs.com/api/ember/release/classes/Router/methods/map?anchor=map) method of your Ember application's router can be invoked to define URL mappings. When calling `map()`, you should pass a function that will be invoked with the value `this` set to an object which you can use to create routes. @@ -39,7 +39,7 @@ Router.map(function() { }); ``` -Inside your templates, you can use [`{{link-to}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/link-to?anchor=link-to) to navigate between +Inside your templates, you can use [`{{link-to}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/link-to?anchor=link-to) to navigate between routes, using the name that you provided to the `route` method. ```handlebars diff --git a/source/routing/rendering-a-template.md b/source/routing/rendering-a-template.md index b513ef3dd..e2b2df73b 100644 --- a/source/routing/rendering-a-template.md +++ b/source/routing/rendering-a-template.md @@ -19,7 +19,7 @@ template. For example, the `posts.new` route will render its template into the `posts.hbs`'s `{{outlet}}`, and the `posts` route will render its template into the `application.hbs`'s `{{outlet}}`. -If you want to render a template other than the default one, set the route's [`templateName`](https://www.emberjs.com/api/ember/2.16/classes/Route/properties/templateName?anchor=templateName) property to the name of +If you want to render a template other than the default one, set the route's [`templateName`](https://www.emberjs.com/api/ember/release/classes/Route/properties/templateName?anchor=templateName) property to the name of the template you want to render instead. ```app/routes/posts.js @@ -30,5 +30,5 @@ export default Route.extend({ }); ``` -You can override the [`renderTemplate()`](https://www.emberjs.com/api/ember/2.16/classes/Route/methods/renderTemplate?anchor=renderTemplate) hook if you want finer control over template rendering. +You can override the [`renderTemplate()`](https://www.emberjs.com/api/ember/release/classes/Route/methods/renderTemplate?anchor=renderTemplate) hook if you want finer control over template rendering. Among other things, it allows you to choose the controller used to configure the template and specific outlet to render it into. diff --git a/source/templates/actions.md b/source/templates/actions.md index 3a56bd893..f1f6f9342 100644 --- a/source/templates/actions.md +++ b/source/templates/actions.md @@ -3,7 +3,7 @@ change application state. For example, imagine that you have a template that shows a blog title, and supports expanding the post to show the body. If you add the -[`{{action}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/action?anchor=action) +[`{{action}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/action?anchor=action) helper to any HTML DOM element, when a user clicks the element, the named event will be sent to the template's corresponding component or controller. @@ -62,7 +62,7 @@ export default Component.extend({ ## Specifying the Type of Event By default, the -[`{{action}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/action?anchor=action) +[`{{action}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/action?anchor=action) helper listens for click events and triggers the action when the user clicks on the element. @@ -116,7 +116,7 @@ will trigger the action *and* the user will be directed to the new page. ## Modifying the action's first parameter If a `value` option for the -[`{{action}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/action?anchor=action) +[`{{action}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/action?anchor=action) helper is specified, its value will be considered a property path that will be read off of the first parameter of the action. This comes very handy with event listeners and enables to work with one-way bindings. diff --git a/source/templates/binding-element-attributes.md b/source/templates/binding-element-attributes.md index 563e136f2..c5f478953 100644 --- a/source/templates/binding-element-attributes.md +++ b/source/templates/binding-element-attributes.md @@ -59,8 +59,8 @@ renders the following HTML: To enable support for data attributes an attribute binding must be added to the component, e.g. -[`Ember.LinkComponent`](https://www.emberjs.com/api/ember/2.16/classes/LinkComponent) -or [`Ember.TextField`](https://www.emberjs.com/api/ember/2.16/classes/TextField) +[`Ember.LinkComponent`](https://www.emberjs.com/api/ember/release/classes/LinkComponent) +or [`Ember.TextField`](https://www.emberjs.com/api/ember/release/classes/TextField) for the specific attribute: ```javascript diff --git a/source/templates/built-in-helpers.md b/source/templates/built-in-helpers.md index 9d6dda652..b7e755d34 100644 --- a/source/templates/built-in-helpers.md +++ b/source/templates/built-in-helpers.md @@ -10,7 +10,7 @@ passing data to another helper or component. ### Using a helper to get a property dynamically -The [`{{get}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/get?anchor=get) helper makes it easy to dynamically send the value of a +The [`{{get}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/get?anchor=get) helper makes it easy to dynamically send the value of a variable to another helper or component. This can be useful if you want to output one of several values based on the result of a computed property. @@ -26,7 +26,7 @@ if the `part` computed property returns "zip", this will display the result of In the last section it was discussed that helpers can be nested. This can be combined with these sorts of dynamic helpers. -For example, the [`{{concat}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/get?anchor=concat) helper makes it easy to dynamically send +For example, the [`{{concat}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/get?anchor=concat) helper makes it easy to dynamically send a number of parameters to a component or helper as a single parameter in the format of a concatenated string. diff --git a/source/templates/conditionals.md b/source/templates/conditionals.md index 5af9a6611..11636e4a3 100644 --- a/source/templates/conditionals.md +++ b/source/templates/conditionals.md @@ -1,5 +1,5 @@ -Statements like [`if`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=if) -and [`unless`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=unless) +Statements like [`if`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=if) +and [`unless`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=unless) are implemented as built-in helpers. Helpers can be invoked three ways, each of which is illustrated below with conditionals. @@ -12,7 +12,7 @@ displaying a property, but helpers accept arguments. For example:
``` -[`{{if}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=if) +[`{{if}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=if) in this case returns `"zoooom"` when `isFast` is true and `"putt-putt-putt"` when `isFast` is false. Helpers invoked as inline expressions render a single value, the same way that properties are a single value. @@ -53,7 +53,7 @@ properties on `person` only if that it is present: {{/if}} ``` -[`{{if}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=if) +[`{{if}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=if) checks for truthiness, which means all values except `false`, `undefined`, `null`, `''`, `0` or `[]` (i.e., any JavaScript falsy value or an empty array). @@ -81,7 +81,7 @@ of that invocation is rendered: ``` The inverse of `{{if}}` is -[`{{unless}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=unless), +[`{{unless}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=unless), which can be used in the same three styles of invocation. For example, this template only shows an amount due when the user has not paid: diff --git a/source/templates/development-helpers.md b/source/templates/development-helpers.md index 5ab72ca8a..991e0b6e8 100644 --- a/source/templates/development-helpers.md +++ b/source/templates/development-helpers.md @@ -6,7 +6,7 @@ your browser's console, or activate the debugger from your templates. ### Logging -The [`{{log}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=log) helper makes it easy to output variables or expressions in +The [`{{log}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=log) helper makes it easy to output variables or expressions in the current rendering context into your browser's console: @@ -18,7 +18,7 @@ The `{{log}}` helper also accepts primitive types such as strings or numbers. ### Adding a breakpoint -The [``{{debugger}}``](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=debugger) helper provides a handlebars equivalent to JavaScript's +The [``{{debugger}}``](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=debugger) helper provides a handlebars equivalent to JavaScript's `debugger` keyword. It will halt execution inside the debugger helper and give you the ability to inspect the current rendering context: diff --git a/source/templates/displaying-a-list-of-items.md b/source/templates/displaying-a-list-of-items.md index 15dc38f1d..b7ae7a98c 100644 --- a/source/templates/displaying-a-list-of-items.md +++ b/source/templates/displaying-a-list-of-items.md @@ -1,5 +1,5 @@ To iterate over a list of items, use the -[`{{#each}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=each) +[`{{#each}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=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. @@ -47,7 +47,7 @@ or removed from the iterated array, the DOM will be updated without having to write any additional code. That said, Ember requires that you use [special methods](../../object-model/enumerables/#toc_use-of-observable-methods-and-properties) to update bound arrays. Also be aware that [using the `key` option with an each -helper](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=each) +helper](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=each) can improve re-render performance when an array is replaced with another containing similar items. @@ -66,7 +66,7 @@ block param. Block params are space-separated, without commas. For example: ### Empty Lists -The [`{{#each}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=each) +The [`{{#each}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=each) helper can have a corresponding `{{else}}`. The contents of this block will render if the array passed to `{{#each}}` is empty: diff --git a/source/templates/displaying-the-keys-in-an-object.md b/source/templates/displaying-the-keys-in-an-object.md index c7ae80b1b..e20ed733f 100644 --- a/source/templates/displaying-the-keys-in-an-object.md +++ b/source/templates/displaying-the-keys-in-an-object.md @@ -1,5 +1,5 @@ If you need to display all of the keys or values of a JavaScript object in your template, -you can use the [`{{#each-in}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=each-in) helper: +you can use the [`{{#each-in}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=each-in) helper: ```/app/components/store-categories.js import Component from '@ember/component'; @@ -59,11 +59,11 @@ The above example will print a list like this: An object's keys will be listed in the same order as the array returned from calling `Object.keys` on that object. If you want a different sort order, you should use `Object.keys` to get an array, sort that array with the built-in JavaScript tools, -and use the [`{{#each}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=each-in) helper instead. +and use the [`{{#each}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=each-in) helper instead. ### Empty Lists -The [`{{#each-in}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/if?anchor=each-in) +The [`{{#each-in}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/if?anchor=each-in) helper can have a matching `{{else}}`. The contents of this block will render if the object is empty, null, or undefined: diff --git a/source/templates/links.md b/source/templates/links.md index 23a14a9bb..d87b1a2b1 100644 --- a/source/templates/links.md +++ b/source/templates/links.md @@ -1,7 +1,7 @@ ## The `{{link-to}}` Component You create a link to a route using the -[`{{link-to}}`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/get?anchor=link-to) +[`{{link-to}}`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/get?anchor=link-to) component. ```app/router.js @@ -116,7 +116,7 @@ The `query-params` helper can be used to set query params on a link: ### Using link-to as an inline component In addition to being used as a block expression, the -[`link-to`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/get?anchor=link-to) +[`link-to`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/get?anchor=link-to) component can also be used in inline form by specifying the link text as the first argument to the component: @@ -149,7 +149,7 @@ adding class names, Ember will also apply the standard `ember-view` and possibly ### Replacing history entries The default behavior for -[`link-to`](https://www.emberjs.com/api/ember/2.16/classes/Ember.Templates.helpers/methods/get?anchor=link-to) +[`link-to`](https://www.emberjs.com/api/ember/release/classes/Ember.Templates.helpers/methods/get?anchor=link-to) is to add entries to the browser's history when transitioning between the routes. However, to replace the current entry in the browser's history you can use the `replace=true` option: diff --git a/source/templates/writing-helpers.md b/source/templates/writing-helpers.md index 3fe7064ee..0b7fe3204 100644 --- a/source/templates/writing-helpers.md +++ b/source/templates/writing-helpers.md @@ -37,7 +37,7 @@ You can also have Ember generate the file for you from the command line: ember generate helper format-currency ``` -That file should export a function wrapped with [`Ember.Helper.helper()`](http://emberjs.com/api/classes/Ember.Helper.html#method_helper): +That file should export a function wrapped with [`Ember.Helper.helper()`](https://emberjs.com/api/ember/2.15/classes/Ember.Helper/methods/helper?anchor=helper): ```app/helpers/format-currency.js import { helper } from '@ember/component/helper'; @@ -394,7 +394,7 @@ would see this: Welcome back! <script type="javascript">alert('pwned!');</script> has joined the channel. ``` -[1]: https://www.emberjs.com/api/ember/2.16/classes/Helper -[2]: https://www.emberjs.com/api/ember/2.16/classes/Helper/methods/compute?anchor=compute -[3]: http://emberjs.com/api/classes/Ember.Helper.html#method_helper -[4]: https://www.emberjs.com/api/ember/2.16/classes/@ember%2Fstring/methods/htmlSafe?anchor=htmlSafe +[1]: https://www.emberjs.com/api/ember/release/classes/Helper +[2]: https://www.emberjs.com/api/ember/release/classes/Helper/methods/compute?anchor=compute +[3]: https://emberjs.com/api/ember/2.15/classes/Ember.Helper/methods/helper?anchor=helper +[4]: https://www.emberjs.com/api/ember/release/classes/@ember%2Fstring/methods/htmlSafe?anchor=htmlSafe diff --git a/source/testing/unit-testing-basics.md b/source/testing/unit-testing-basics.md index 7d85cebf4..4533ebfe8 100644 --- a/source/testing/unit-testing-basics.md +++ b/source/testing/unit-testing-basics.md @@ -2,6 +2,7 @@ Unit tests (as well as container tests) are generally used to test a small piece and ensure that it is doing what was intended. Unlike application tests, they are narrow in scope and do not require the Ember application to be running. + Let's have a look at a common use case - testing a service - to understand the basic principles of testing in Ember. This will set the foundation for other parts of your Ember application such as controllers, components, helpers and others. Testing a service is as simple as creating a container test, diff --git a/source/tutorial/autocomplete-component.md b/source/tutorial/autocomplete-component.md index eab647be1..6756e440a 100644 --- a/source/tutorial/autocomplete-component.md +++ b/source/tutorial/autocomplete-component.md @@ -105,7 +105,7 @@ The `filter` function is passed in by the calling object. This is a pattern know Notice the `then` function called on the result of calling the `filter` function. The code expects the `filter` function to return a promise. -A [promise](https://www.emberjs.com/api/ember/2.16/classes/Promise) is a JavaScript object that represents the result of an asynchronous function. +A [promise](https://www.emberjs.com/api/ember/release/classes/Promise) is a JavaScript object that represents the result of an asynchronous function. A promise may or may not be executed at the time you receive it. To account for this, it provides functions, like `then` that let you give it code it will run when it eventually does receive a result. @@ -285,7 +285,7 @@ The `value` property represents the latest state of the input field. Therefore we now check that results match the input field, ensuring that results will stay in sync with the last thing the user has typed. While this approach will keep our results order consistent, there are other things to consider when dealing with multiple concurrent tasks, -such as [limiting the number of requests made to the server](https://www.emberjs.com/api/ember/2.16/classes/@ember%2Frunloop/methods/debounce?anchor=debounce). +such as [limiting the number of requests made to the server](https://www.emberjs.com/api/ember/release/classes/@ember%2Frunloop/methods/debounce?anchor=debounce). To create effective and robust autocomplete behavior for your applications, we recommend considering the [`ember-concurrency`](http://ember-concurrency.com/#/docs/introduction) addon project. @@ -368,7 +368,7 @@ Our `filterByCity` function is going to pretend to be the action function for ou We are not testing the actual filtering of rentals in this test, since it is focused on only the capability of the component. We will test the full logic of filtering in application tests, described in the next section. -Since our component is expecting the filter process to be asynchronous, we return promises from our filter, using [Ember's RSVP library](https://www.emberjs.com/api/ember/2.16/modules/rsvp). +Since our component is expecting the filter process to be asynchronous, we return promises from our filter, using [Ember's RSVP library](https://www.emberjs.com/api/ember/release/modules/rsvp). Next, we'll add the call to render the component to show the cities we've provided above. diff --git a/source/tutorial/installing-addons.md b/source/tutorial/installing-addons.md index 3c20d2894..d7ac327e6 100644 --- a/source/tutorial/installing-addons.md +++ b/source/tutorial/installing-addons.md @@ -142,7 +142,7 @@ For now, let's generate an adapter for our application: ember generate adapter application ``` -This adapter will extend the [`JSONAPIAdapter`](https://www.emberjs.com/api/ember-data/2.16/classes/DS.JSONAPIAdapter) base class from Ember Data: +This adapter will extend the [`JSONAPIAdapter`](https://www.emberjs.com/api/ember-data/release/classes/DS.JSONAPIAdapter) base class from Ember Data: ```app/adapters/application.js{+4} import DS from 'ember-data'; diff --git a/source/tutorial/model-hook.md b/source/tutorial/model-hook.md index 160d6758c..cd3589cb5 100644 --- a/source/tutorial/model-hook.md +++ b/source/tutorial/model-hook.md @@ -11,7 +11,7 @@ Here's what our homepage will look like when we're done: ![super rentals homepage with rentals list](../../images/model-hook/super-rentals-index-with-list.png) In Ember, route handlers are responsible for loading the model with data for the page. -It loads the data in a function called [`model`](https://www.emberjs.com/api/ember/2.16/classes/Route/methods/model?anchor=model). +It loads the data in a function called [`model`](https://www.emberjs.com/api/ember/release/classes/Route/methods/model?anchor=model). The `model` function acts as a **hook**, meaning that Ember will call it for us during different times in our app. The model function we've added to our `rentals` route handler will be called when a user navigates to the rentals route via root URL `http://localhost:4200`, or via `http://localhost:4200/rentals`. @@ -108,6 +108,7 @@ To check that rentals are listed with an automated test, we will create a test t In `app/templates/rentals.hbs`, we wrapped each rental display in an `article` element, and gave it a class called `listing`. We will use the listing class to find out how many rentals are shown on the page. + To find the elements that have a class called `listing`, we'll use the method [`querySelectorAll`](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll~). The `querySelectorAll` method returns the elements that match the given [CSS selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors). In this case it will return an array of all the elements with a class called `listing`. diff --git a/source/tutorial/service.md b/source/tutorial/service.md index da91a36ea..927684100 100644 --- a/source/tutorial/service.md +++ b/source/tutorial/service.md @@ -306,7 +306,7 @@ In the second test, only one assert is expected (line 33), since the map element Also, note that the second test uses a dummy object as the returned map element (defined on line 5). Our map element can be substituted with any object because we are only asserting that the cache has been accessed (see line 39). -The location in the cache has been [`camelized`](https://www.emberjs.com/api/ember/2.16/classes/String/methods/camelize?anchor=camelize) (line 35), +The location in the cache has been [`camelized`](https://www.emberjs.com/api/ember/release/classes/String/methods/camelize?anchor=camelize) (line 30), so that it may be used as a key to look up our element. This matches the behavior in `getMapElement` when city has not yet been cached. diff --git a/source/tutorial/subroutes.md b/source/tutorial/subroutes.md index daeadb38a..e912b18d7 100644 --- a/source/tutorial/subroutes.md +++ b/source/tutorial/subroutes.md @@ -339,7 +339,7 @@ Now browse to `localhost:4200/rentals/grand-old-mansion` and you should see the Now that we can load pages for individual rentals, we'll add a link (using the `link-to` helper) within our `rental-listing` component to navigate to individual pages. Here, the `link-to` helper takes the route name and the rental model object as arguments. -When you pass an object as second argument into the `link-to` block helper, it will by default [serialize](https://www.emberjs.com/api/ember/2.16/classes/Route/methods/beforeModel?anchor=serialize) the object to the ID of the model into the URL. +When you pass an object as second argument into the `link-to` block helper, it will by default [serialize](https://www.emberjs.com/api/ember/release/classes/Route/methods/beforeModel?anchor=serialize) the object to the ID of the model into the URL. Alternately, you may just pass `rental.id` for clarity. Notice also that we are providing `rental.id` as the class attribute on the `link-to`. The class name will help us find the link later on in testing.