Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Fixed syntax highlighting and wrong-property-used issue #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Docs/Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ In this exercise, we'll add some additional properties to our controller so we c
### Step 1: Add additional properties to the dataController
We want to show the number of items that are in our data controller, including the total count, how many have been read, how many are unread, and how many are starred. Ember allows us to make a function act like a property by adding `.property()` to the end of the function. The value we pass to the property function tells Ember when the specified item is updated, it needs to update the value of the property.

Let's look at an example for readCount:
Let's look at an example for the `readCount` method:

readCount: function() {
return 1;
}.property('@each')
return 1;
}.property('@each.read')

Right now, it simply returns 1, but we want it to return the number of read items in our data controller. To do that, we need to get the list of read items, and then get the length of that filtered list. Ember provides an easy way to filter objects with the `filterProperty(name, value)` function. Let's replace the `return 1;` with `return this.filterProperty('read', true).get('length');`

Expand Down
5 changes: 3 additions & 2 deletions Exercise03/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@



// Create the all up Ember application
var WReader = Em.Application.create({
ready: function() {
Expand Down Expand Up @@ -73,7 +72,9 @@ WReader.SummaryListView = Em.View.extend({
tagName: 'article',
classNames: ['well', 'summary']

/* Exercise 3.4 */
/* Exercise 3.4a */

/* Exercise 3.4b */

/* Exercise 3.5 */

Expand Down