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

Commit a58c8eb

Browse files
author
Rishabh Rao
committed
Under Exercise 3, the example for readCount was not using syntax highlighting. Also, changed .property('@each') to .property('@each.read').
1 parent d590835 commit a58c8eb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Docs/Instructions.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,11 @@ In this exercise, we'll add some additional properties to our controller so we c
121121
### Step 1: Add additional properties to the dataController
122122
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.
123123

124-
Let's look at an example for readCount:
124+
Let's look at an example for the `readCount` method:
125+
125126
readCount: function() {
126-
return 1;
127-
}.property('@each')
127+
return 1;
128+
}.property('@each.read')
128129

129130
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');`
130131

0 commit comments

Comments
 (0)