Sharing data with Services - How to

I have an app in which you can a make checklist and in a checklist there are items that can be checked off. I would like to have a count of checked items on the checklist homepage. The app uses a Data service and I was hoping to pull the count from this and display it on the homepage.

Homepage

On line 134 I have getItemsCount() but it’s throwing a syntax error.

getItemsCount() works when used on the checklist items page (line 90) since it’s in scope.

Goal: to display number of checked items (works on checklist items page) on the checklist homepage.

Why is return count; inside a loop?

You pointing this out helped me to figure out the rest of the problem I was having. Thank you!