justinc (16) [Avatar] Offline
I love the book so far but have run into a problem.
CH7, p224 - after changing the homelist & _renderHomepage functions, when I reload the browser, I see this error

Cannot read property 'length' of undefined

22| p.address= location.address
23| .facilities
> 24| each facility in location.facilities
25| span.badge.badge-warning= facility

I have facilities loaded for all 3 locations in my mongodb (I checked)

if I add the error handling code later in the chapter, I receive the 'API lookup error' from this section of code in _renderHomepage
let message = null;
if (!(responseBody instanceof Array)) {
message = 'API lookup error';
responseBody = [];

not sure why it's not coming back as an Array or why facilities aren't listed.

justinc (16) [Avatar] Offline
I figured it out!!

I looked back at the controller and the locationsListByDistance function

I had a typo for my geoNear call and then had to set the maxdistance higher
simon.holmes (148) [Avatar] Offline
Hi Justin, glad you figured it out!