Я только что создал приложение angularjs, использующее geofire для определения местоположения. Он отлично работает на производстве, но у меня возникают проблемы при его развертывании в Firebase. Я считаю, что ошибка должна быть отсюда
getLocations(radius: number, coords: Array<number>) {
console.log(radius, coords)
this.geoFire.query({
center: coords,
radius: radius
})
.on('key_entered', (userKey, location, distance) => {
//we need to check this because this.hits the behavioursubject already cached previous result and geofire fetches again each time we go back to homepage
const existAlready = this.hits.value.filter(h=>h.userKey === userKey)
if(existAlready.length > 0){
return
}
console.log(userKey)
const u = this.userList.query.ref
.child(`/${userKey}`)
.on('value',s=>{
const {name, address} = s.val()
console.log(s.val())
let hit = {
location,
distance,
name,
address,
userKey
}
let currentHits = this.hits.value
currentHits.push(hit)
this.hits.next(currentHits)
this.eventService.sendMessage(Constants.EVENT_MESSAGES.LOADING, true)
})
})
}
Приведенный выше код предназначен для получения мест вокруг меня, как только приложение загрузится. Но вместо этого я получаю эту ошибку
@ firebase / database: FIREBASE WARNING: Исключение было сгенерировано пользователем
Перезвоните. Ошибка типа: невозможно прочитать свойство 'myID' из неопределенного
Ошибка поступает только в производство