This course has been updated! We now recommend you take the Ember Octane Fundamentals course.
Transcript from the "Exercise 3" Lesson
>> Mike North: I'm gonna go over the next step to our wonderful little GitHub app. So we're gonna have this concept of favoriting orgs. Favoriting orgs, and I want the service to hold the source of truth for the set of favorite orgs. So, a couple steps here. I think this time I'm on one page, but yes, and just a screenshot of the result.
[00:00:34] So we wanna create a service called Favorites, with an array on it called Items, and I already did something that is just a change of names away from that. We want that service to be available on the route for the orgs list, and then, next to each org, inside the each helper, I want a span with an action binding on it.
[00:01:04] And then an action on the route that will add that appropriate org to the list of favorites. And at the bottom here, and just so we have some feedback, because the visual state will not actually update as you favorite. We're gonna take care of that in the next step.
[00:01:28] But you should console.log every time that you add something, just so you can see feedback that you've actually favorited something. And what I'm suggesting is just log the whole array, dot join comma, so that you can kind of see what's going on. And the last thing is, addObject will check for presence as long as you're using primitive values.
[00:01:55] If you're using objects, as we just saw, each one is a unique instance, you know. So this is what you're aiming for, something that looks like this. Where if I click, you get something like this logged to the console.