on car.ts component.
I call simulate.ts’s function
and want to return car_array value from simulate.ts…
but when I console.log on car.ts this.simulate.getCars(lat,lng), it is undefined…
car.ts
getCars(lat,lng){
console.log(this.simulate.getCars(lat.lng)
return this.simulate.getCars(lat,lng)
}
simulate.ts
getCars(lat,lng){
this.items = this.afd.list('/employees/Available/', { preserveSnapshot: true });
this.items.subscribe(snapshots=>{
do some works.....
......
..this.array_car.push(some value)
return this.array_car
}
}